STILL TESTING Fix min max bug

This changes the algorithm from the old min/max one to one where it has a window range it fills in, then jumps forward to get a new window.

I'm testing it in my datahub on a real example, and have offered to try it with a customer too.

Would like a code review meanwhile though!