Refactored
Merge conflict resolved
Refactored slightly