Replaced return max with return data