Refactoring and bugfix
Small fixes