Move more controller logic to controllers module.