scaling to max-function