Use a custom shared ptr instead of crappy custom memory management