main part of text processing section