Switch to reference counted allocations