added basic preprocessing code