Fix incorrect or missing type annotations.
Fix missing properties.
Remove some dead code.