add README.md, restructure tests, fix code