Refactored and formatted code
Ignore