restructured devices into dictionary