Final cleanup and bugfixes