Changed destructing, added basic type checking