bugfixes and streamlining