sweep2unlock: relocate main code, reformat it, change debug echo, slight 3rd barrier adjustment