Removes most of the duplicated parse functions, introduces a common assert_field function with a more expressive error message.
Move common OPL creation code into a function and remove unused imports.