Refactor OutputHandler.py