Refactor output