Refactored to make it readable