Implemented the two functions.