refactoring fixes