lots of changes & bugfixes