Simplified the logic, and fix the issue of having a nested list as entry. Also indicate that we deliberately want to retain $null values (and i.e. do not want them to be turned into a boolean).