further cleanup and bugfixes