dynamic memory freed, small code changes
Merge pull request #1 from Syntaf/master

dynamic memory freed, small changes