Commit logic for gem swapping and other improvements.