Refactored: Moved output mechanism into separate class.