Found huge logical error and fixed small bug.