refactoring and comment code