Added text file logic