@Override
	public void run() {
		
		long lastTime = System.nanoTime(); //nano is much preciser
		long timer = System.currentTimeMillis();
		final double ns = 1000000000.0 / 60.0; //how many time to run the update methode
		double delta = 0;
		int frames = 0;
		int updates = 0;
		requestFocus();
		// keep on doing whats in here
		while (running) {
			long now = System.nanoTime(); // very small time passed from lastTime and now
			delta += (now-lastTime) / ns;
			lastTime = now;
			//calculate the time that takes to get from the beginning of the loop til the end.
			while (delta >= 1) {
				update(); // logic (keep the fps manageable)
				updates++;
				delta--;
			}
			render(); // display
			
			frames++;
			
			if(System.currentTimeMillis() - timer > 1000) {
				timer += 1000;
				
				frame.setTitle(title + "  |  " + updates + " ups, " + frames + " fps");
				updates = 0;
				frames = 0;
			}
		}
		
		stop();
	}