Added code for expanding lists in list elements.