Refactored the fix to be more readable