lots of bugfixes & enhancements