Refactoring closed world reasoner.