refactoring search to properly use resources