added exit conditions now