Made a helper function for extracting predictions