Refactored the code that displays win/lose message