Added destructor and query functions