License update, refactoring and bugfixes