a bit of rewrites and bugfixes + 2 more tests