Code Cleanup

Moved search functions to a controller