refactor code step-1