implemented the required functions