Rewriting Badge Prediction routine