I'm not sure I get what this is for or what the if statement is supposed to do.

If no max is set, we should not be limiting it. Max is optional, so just do not specify a max.