Add some documentation, clean up initialization.