added results section for sample.txt and applied logic for special functions