Refactored search space functions