Move application state from static fields to a global instance.

Signed-off-by: John McCutchan <john@johnmccutchan.com>