Rename io to input
Refactor out reading istream char by char
Consistent checks for start of iteration