Added the fix method
Refactored code