Debugged for syntax to work. Not sure about the logic yes. Looking at it now. First impressions suggest that cummulative_reverse is not being used really anywhere.