Refactoring to fix new quiz errors. Closes #331.