controllers refactor