updated script for pre-processing data