Some minor restructuring and a lot of comments