Updated with Refactoring