refactoring of device functions to deviceManager