Fix docblocks and add typehints.