Complete device re-creation logic
Code refactoring