Implemented the add function