pre output refactor