Implemented the constructor and destructor.