refactoring + bugfix