mfold refactor