Updated preprocess code