as I suggested, this `reduce` is better in the init function, like you did initially