Fixing text parsing.

Tests now pass.
Merge pull request #3 from oliverzheng/master

Fixing text parsing