refactor duplicate