refactor controller methods