moving parser out to increase DRY