Further refactoring to separate the authenticator from IO messiness. Also, adopt Iterable over List.