fixing nested list case
refactoring tests