Some improvements that I've made when adapting it for my use.
Merge pull request #4 from SimeonC/master

Some improvements that I've made when adapting it for my use.