finished and tested preprocessing script