Added code for the two functions