Refactoring the ontology