refactors controllers