exam refactored