refactored exam