generalize to higher orders