add condition for maxmium