qny described the logic in post #2.