Refactor stdout