refactor duplicate method