Changed min and max statements