refactoring some more