speed up of range search function