Cleanup and add some docs.