text processing code