Fixing while/if block for case 5 invalid input