cleanup and addition of proper destructors