Implemented the functions