Move definition parsing to a separate class to facilitate testing