refactor scaling