adding the code for the functions