Added comments, rearranged a few more things

Also fixed some spelling errors.