Additional comments added

Added some additional comments to explain why some of this is written the way it is.