restructure search module code to conform to Angular best practices