implemented max-norm logic.