Wrote out the functions