public void run()
	{
		int frames = 0;
		double unprocessedSeconds = 0;
		long previousTime = System.nanoTime();
		double secondsPerTick = 1 / 60.0;
		int tickCount = 0;
		boolean ticked = false;

		while (running)
		{
			long currentTime = System.nanoTime();
			long passedTime = currentTime - previousTime;
			previousTime = currentTime;
			unprocessedSeconds += passedTime / 1000000000.0;
			requestFocus();

			while (unprocessedSeconds > secondsPerTick)
			{
				tick();
				unprocessedSeconds -= secondsPerTick;
				ticked = true;
				tickCount++;
				if (tickCount % 60 == 0)
				{
					if (showFps == true)
					{
						fps = frames;
					}
					previousTime += 1000;
					frames = 0;
				}
			}

			if (ticked)
			{
				render();
				frames++;
			}
			render();
			frames++;
			
			newX = InputHandler.MouseX;
			if (newX > oldX)
			{
				System.out.println("right");
				Controller.turnRight = true;
			}
				
			if (newX < oldX)
			{
				System.out.println("left");
				Controller.turnLeft = true;
			}
				
			if (newX == oldX)
			{
				Controller.turnLeft = false;
				Controller.turnRight = false;
			}
			
			oldX = newX;
		}
	}