@Override
  public void load() throws InvalidConfigurationFileException, DriverException {
    if (loaded) destroy(); // reset driver

    loaded = true;

    IntByReference pcount = new IntByReference(0);
    checkRC(KinectLibrary.INSTANCE.NuiGetSensorCount(pcount));

    if (pcount.getValue() == 0) {
      throw new DriverException("No connected devices");
    }

    KinectDevice.ByReference newDevice = new KinectDevice.ByReference();

    checkRC(KinectLibrary.INSTANCE.NuiCreateSensorByIndex(0, newDevice));
    device = newDevice.getDevice();
    checkRC(
        device.NuiInitialize(
            new DWORD(
                KinectLibrary.NUI_INITIALIZE_FLAG_USES_COLOR
                    | KinectLibrary.NUI_INITIALIZE_FLAG_USES_SKELETON
                    | KinectLibrary.NUI_INITIALIZE_FLAG_USES_DEPTH)));

    nextColorImageFrame = Kernel32.INSTANCE.CreateEvent(null, true, false, null);
    nextDepthImageFrame = Kernel32.INSTANCE.CreateEvent(null, true, false, null);
    nextSkeletonFrame = Kernel32.INSTANCE.CreateEvent(null, true, false, null);
    nextInteractionFrame = Kernel32.INSTANCE.CreateEvent(null, true, false, null);

    HANDLEByReference handle = new HANDLEByReference();
    checkRC(
        device.NuiImageStreamOpen(
            new JnaEnumWrapper<>(NUI_IMAGE_TYPE.NUI_IMAGE_TYPE_COLOR),
            new JnaEnumWrapper<>(NUI_IMAGE_RESOLUTION.NUI_IMAGE_RESOLUTION_640x480),
            new DWORD(0),
            new DWORD(2),
            nextColorImageFrame,
            handle));

    colorStream = handle.getValue();

    checkRC(
        device.NuiImageStreamOpen(
            new JnaEnumWrapper<>(NUI_IMAGE_TYPE.NUI_IMAGE_TYPE_DEPTH),
            new JnaEnumWrapper<>(NUI_IMAGE_RESOLUTION.NUI_IMAGE_RESOLUTION_640x480),
            new DWORD(0),
            new DWORD(2),
            nextDepthImageFrame,
            handle));

    depthStream = handle.getValue();

    checkRC(device.NuiSkeletonTrackingEnable(nextSkeletonFrame, new DWORD(0)));

    interactionClient = new INuiInteractionClient();

    INuiInteractionStream.ByReference newStream = new INuiInteractionStream.ByReference();
    checkRC(
        KinectToolkitLibrary.INSTANCE.NuiCreateInteractionStream(
            device, interactionClient, newStream));
    interactionStream = newStream.getStream();

    checkRC(interactionStream.Enable(nextInteractionFrame));
    new Thread(new BackgroundThread()).start();
  }