generalize function repetitions
ref