factor identical functions together
Merge branch 'master' into 366-aggregate-runtime