Hi - There's a possible bug with this code regarding storing the actual *intervals* that lead to the maximum weight ...

Hi - There's a possible bug with this code regarding storing the actual *intervals* that lead to the maximum weight.  I don't have a possible fix here because I discovered this when migrating this code to C++ (not in a Git repository at the moment).

The code comments in this pull request describe the possible bug.  Let me know if you agree, if you have a chance at some point!

Thanks,
Dan