The node you are looking for is at Scheme - Separating key cancellations from key signature changes.