Implemented the required functions.