refactoring controller mixin