extended test suite, cleanup, minor bugfix