Added Javascript and existing endAttemptInteraction implementation