Reorganize and cleanup initialization.

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