refactor output