factor identical functions together
Merge branch 'master' into 423-refactor-summary