scaling refactoring