add destructor. complete documentation throughout