Changed/added some comments.
Moved some functions around.
Some minor edits.