Updated js logic for quiz.