device control refactoring