Preprocess context