void PollKeysMac()
    {
        while (UseRealTimeInput)
        {
            averageTimer.startRecording();

//			UnityEngine.Debug.Log (timeMaster.GetTime());
//			bool aPressed = CGEventSourceKeyState (1, 0);
            //			UnityEngine.Debug.Log (CGEventSourceKeyState(1, 0));
            //			stopwatch.Reset();
//			if (listener != null) {
            for (int i = 0; i < trackedKeys.Count; i++)
            {
                StandardKeyCodes keyCodeStandard = trackedKeys [i];
                int  keyCode       = KeyConverter.ToMacNative(keyCodeStandard);
                bool keyPressed    = CGEventSourceKeyState(1, keyCode);
                bool prevKeyStatus = keyStates [keyCode];
//					UnityEngine.Debug.Log (keyPressed);
                if (keyPressed && !prevKeyStatus)                  //going from false to true
//						listener.onKeyDown (keyCode, timeMaster.GetTime());
                {
                    keyDowns[keyCodeStandard] = timeMaster.GetTime();
                }
                else if (!keyPressed && prevKeyStatus)
                {
//						listener.onKeyUp (keyCode, timeMaster.GetTime());
                    keyUps[keyCodeStandard] = timeMaster.GetTime();
                }
                keyStates [keyCode] = keyPressed;
            }

            long avg = averageTimer.stopRecording();
            if (avg != -1)
            {
//				UnityEngine.Debug.Log(avg);
                if (debugPanel)
                {
                    debugPanel.log("Input", avg.ToString());
                }
//				debugPanel.log ("Input", avg.ToString());
            }
            Thread.Sleep(sleepTime);
        }
    }