Fixing unclosed if else