more robust variable and condition parsing