reorder steps to do the output step later