Extract parsing to a Parser class