Cosmetics: rearrange functions to simplify ifdeffery