Added comments and fixed locations of code
General Fixes