Replaced references to global currentDevice object.