Fixing global leaks & formatting.