Chage the ending conditions