Hint
Move quiz_create_rid() helper function to helper class.
Move more take logic to helper classes.
clean up