added nfsmHelper and more logic to trim dicts (if empty value, then delete node)