split into different packages, added tests, docs