Refactored as per PR