Tidyied imports, removed use of itertools.repeat