added destructors and removed explicit free()s