changing Trie to use the new aliasDefinitions method and improving tests for nested aliasDefinitions - fixes #717