mostly working text parsing