Reorganized #ifdef code