Finished pred function