Improved file verification while parsing

Now allows more robust specification of the expected types of
elements of the YAML file. Also added a more explicit error message
when types don't match expected types while parsing.