Refactored and sanitized Questionnaire.js