changing code to work with a switch staement for each preprocessing step