Memory tracker + fixed some mem leaks