added simple scaling code