         peripheral = nil
         cleanUp()
         
-        if aborted {
+        guard !aborted else {
             resetDevice()
             return
         }

        } else {
            logger.i("Services discovered")
            
            if aborted {
                resetDevice()
                return
            }

    }
    
    override func peripheralDidDisconnect() {
        guard !aborted else {
            // The device has resetted. Notify user
            logger.w("Upload aborted")
            delegate?.peripheralDidDisconnectAfterAborting()
            return
        }
        
        if shouldReconnect {
            shouldReconnect = false
            // We need to reconnect to the device
            connect()
