Moved track search codes from view to controller.