allegro search refactoring