Simplified code and tests. Added Definition class.
Fixed tests.