a few changes to max sum