In Lua we usually don't use parentheses in if statements. This code is much more clear what is happening than the previous one-liner. Is max_bonus used still, or can it be removed?