Basic reordering of the code