experimental refactoring for BMS preprocessor.