refactor code --