rewritten with attoparsec
rewritten with attoparsec