pass state to all functions that may mutate it
accumulate function attributes