Refactored the client code (it's better now, I swear) and updated the example to match.