Change optimization and bugfixes