Wrote the functions.