adding function to preprocess page