Added lots of comments/documentation

Slightly less of a mess now and getting ready to do some real work.