Added preprocess function