More refactoring. Added text parsing.