more tests + bugfixes
minor refactor + basic tests complete