working algorithm for price ranges!