Refactor controllers, split functionality