added scale code