Improved the prediction script