updates and changes to support more complex reference logic
revised handling of references and wildcards