split condition for flexibility
add commented code for doFit==8