Refactor some code.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
Improve data parsing.
Fix DELIMITER detection issue.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>