Added comments and altered small sections of code