Move request handling functions to controller