Improve the process for how state is passed along to the client app.

Closes #6