Extension theory and the calculus of butterflies