Flesh out prediction function