refactor's controller