refactoring of some UI code, ensuring the exam works for demonstration