Refactoring for reusability
Adding scope isolation