Add type signatures, documentation.