implemented createDevice functionality