minor
add exit condition
corrections