Bugfixes
Refactoring