Updated script for data building for prediction