added code for the two functions