Use THEMAX instead of MAX, as THEMAX is defined locally, and