added tests and refactored slightly
merging upstrean
Merge pull request #15 from wick-ed/master

reviewed diff and tested locally