Added logic for populating categories dictionaty