Fixed by using a set instead of a list.