Bugfixes and various modifications & improvements