Resolved major memory leaks