Reordering of some code