Handle the separator inside and outside list elements

This is an enhancement to the old behaviour, which inserted duplicated separators