redo min/max calculations