fixed small bug and removed unused code