Reordering and cleanup