Code from a pairing session with Bob Scott