edited rotation and scaling code