refactored c_mode