added the code to the function