Replaced the dictionary with one that has frequency values, bug fixes.