Type annotations and refactoring