modified generic api, added custom accumulator