Add Definition class and refactoring