Modify initDictionary() and destroyDictionary() and added test code