Added top-level type signatures, cleaned some imports.