Major refactoring of Definition and Mod classes. Changes to overall program structure.