some minor rearrangement of uses and ifdefs