Makes sense. Refactored as per suggestion