Modified type-of-file and aded replace function just for text.