Refactoring and cleaning up (e.g. output)