More complete example code

Add request handling to example code.