some minor rearrangement