Added or modified a lot of comments; made some minor tweaks to white space.