Removed an element ordering assumption and repositioned output.