updated mass scaling code