Added some visual blocks to make the pieces clear since everything is in one file. More minor cleanup.