refactoring, bugfix #4