Merge pull request #347 from Phyn/master

Cleanup local usage and add null check
Phyn forgot how to ;
Merge pull request #1 from sinkillerj/master

Update from master