Refactoring: methods generation, type checking