Modified function addDataToDictionary and added some new tests for it