Have written the funcitons