update scaling code