Completed the body of the two functions