Updated comments and exit conditions