move accumulate to its own function
beginnings of 'then'