improved text parser