refactor + some tests, all should work now
update README.md