public void handleEndGame(boolean hasWon){		
		int val;
		String name = null;
		if (hasWon){
			timer.stop();// pause timer
			if (timeElapsed < scores.get(9).time)
				name = JOptionPane.showInputDialog(this, "New High: " +
						String.format("%.2f",timeElapsed) + ". What's your name?");
			if (name != null && !name.isEmpty()){
				Score temp = new Score(timeElapsed, name);
				int i = 9;
				for (; i >= 0 && temp.compareTo(scores.get(i)) < 0; --i);
				scores.add(i + 1, temp);
				scores.remove(10);
				//save highscore
				JOptionPane.showMessageDialog(this, scoresAsString(), "Scores",
						JOptionPane.INFORMATION_MESSAGE);
			}
			
			val = JOptionPane.showConfirmDialog(this, "Restart?", "Game Over",
					JOptionPane.YES_NO_OPTION,
					JOptionPane.QUESTION_MESSAGE);
			if (val == JOptionPane.YES_OPTION)
				resetGame();
			else{
				writeToFile();
				System.exit(0);
			}
		}else{
			timer.stop();// pause timer
			val = JOptionPane.showConfirmDialog(this, "You lost. Restart?", "Game Over",
					JOptionPane.YES_NO_OPTION,
					JOptionPane.QUESTION_MESSAGE);
			if (val == JOptionPane.YES_OPTION)
				resetGame();
			else{
				writeToFile();
				System.exit(0);
			}
		}
	}