Rearrange source code.
Fix tests regarding a behavior change in xworkflows-1.0.0