small rearrangements of the code