output management and TODO refactoring