Reworking parser logic