Avoid using itertools as exception checking is good enough