Fixed resource leak
Fixed unused import
Fixed local variable never used
Merge pull request #26 from Brianum/master

Fixed some issues