Redo list processing to handle some edge cases
remove test script