extracted the logic, added minimal tests
Issue #3 / Pull Request #4: Finish refactoring CSV parser as a standalone library. Update unit tests written by @truher to use new parser API.