refactor fix repetition