Continuing previous commit -- CAS is still terribly messy, but better than before