fixed a small bug, removed some unused code