cleaned up and added debug output to ctors and dtors