Wrote score function!