Changed the location of preprocessing code