Fixed memory leak + more comments