refactor is duplicate

craete function is duplicate