refactoring and additional things