refactored search code a little. Its a little more dry...just a little