Close GH-5: refactor, add tests, update readme..