clean up the code a bit, and changed the name of the output file to
model.txt instead of dictionary.txt