I believe I fixed both problems, but the trailing characters at the end of the text file make it hard to tell if the opening if statement change actually worked - I don't know why the trailing characters are there.