added comments and deleted depricated code