restructured to fit for preprocessor