Remove dead code.
Set correct variable.
Remove unnecessary MAX macro uses.