updated logic - outputing ordered dictionary data structure