refactored line 38 to use 'else'