Refactoring runtime metamodels