Ha rewrite for programmable scaling limits

[merge]