Refactor 'search for a range'.