added new codes to preprocess dataset