Refactored the way devices are created and organized