Refactoring, documenting and tests for FreeText