cleanup: take advantage of unmanaged class

this centralizes a few of the hacky places where we explicitly
manage object lifecycles