WIP Fixing memory  leaks