code refactoring and modify defined function name