Wrote and commented functions