Major refactoring of controllers