refactored code for question screen