remove some unnecessary code
implement destructors