moved MAX constant outside lib