Added the code for the functions