rewrote some of the client using the sunny model-based idiom