Some weak ptr stuff i'm not too happy with