added Gregs script for preprocessing