working version of TextReader, code messy no tolerance yet