Clean up types and add missing docs.