Added detachDevice method