parsing functionalty more robust