finished scale function