new unit tests, cleaning some things up, bugfixes