Wrote the two functions