Updated PredictionHandler to support contexts