Refactored to follow better pattern
Fixed merge conflict