Tighten list detection and add more tests