coding the functions