math error - was taking a min instead of max, and max instead of min - causing all sorts of slowness for finding the nearest bins