refactored search functions
refactored utility functions