refactoring some