Added the possibility for preprocessing to flat