refactored with newmethod that takes in device name