v2 changes

Import changes from v2 branch
Merge pull request #4 from matt40k/master

v2 changes