Max function.