refactoring to move output to views