Refactor code to work with new Search structure