WIP - more bugfixes and start of testsuite reimplementation