Added documentation

Added comments for all the blocks, and make the code FOR SURE work.