Remove memory leaks, add comments, improve variable names