added preprocess function