search and locale refactored