some global refactoring