Improve types and specs.