Changed infinity to int(max)