Having to call this all over the place is unfortunate. Can we encapsulate this somehow? This strikes me as a memory safety issue.