1. fixed: #16
2. Fixed some memody (resource) leaks
3. Improved something I don't remember