more cleanup, bugfixes