bugfixes,pruning,cleanup