refactored output