Fixed several leaks
Removed debug code
Found another memory leak