Rearranged stuff a bit, added acquire/release semantics