moved controller functions to controller service