Refactor data parsing logic into private generator

Parser is now much cleaner and decomposed. The sniffer can also use the generator to reduce duplicate parsing logic (still todo).