Small rearrangement of code