updated code to include preprocessing on test data