See comment above in getQuestion.php, refactor this code