Some more changes and bugfixes