Cleanup, missing barrier, add sanity checks.