Working for arbitrary text files