Move `compare-and-set` logic to external scripts