refactor geo search function for performance