Replaced comparasion with Math.max() function.