fixed small bug and removed extra code