Refactor Search - no more hand-coded SQL queries!