Add MAX_LEVEL macro.
Ensure that max_data will always be equal to the maximum level by making the maximum level a global macro.