re-factors summaryCtrl code