cherry-picked and back-ported all major bugfixes and cleanups from the development branch and release version 1.0.2 with it