minor refactoring and performance optimization for writingscaledscores updates