tidy up quiz code