Final modifications and bugfixing