Prediction Engine refactoring