Refactor search in shifted sorted list