Add condition for nested lists