Modified findmax.m