range search working but could be improved