Added preprocessing routines