small fix + refactoring