Added destructor, moved unused debug code