Wouldn't it be better to use a Set here? `List.contains` is more expensive, and there doesn't seem to be a need to maintain order -- or am I missing something?