Update traverse to handle contexts.