Better comments, fixed memory leak

- Improved comments
- Fixed memory leak