added more comments and deleted unnecessary