If/when the time comes that you need non-blocking code, runTest can (easily?) be changed into a routine that is meant to be called very frequently.
To do its job (or nothing) one step at a time and perhaps return a value that indicates whether pass_code did in fact end up letting something else happen and maybe even why.
a7