Updates. Uses a new function "leave3" for leaving on the second pass.