Refactoring Chetan's Code