Changed where min & max were declared