Modifications and bugfixes