Added comments cleaned up some code