Added comments and removed extraneous code