This may be what Robbie Dee is tying to tell be but I am just not following
Only track total bet by player, last aggressor, and if they are folded or not
determine minimum bet from all player in the pot
and player not foldedremove that amount from the every player (including folded) bet
and sum it into a side-potbased on hand strength divvy up that side pot to player stacks
if a split (tie) and there are odd chips then donate that to the next side pot
if last side-potassign my hand position at the odd chips go to last aggressor
(that part I am not sure of actual rules but odd chips are a relatively small amount of money)tablereset side-pot to zero (plus left over)
go to 1) if any player any player has any bet left
(a hand cannot end with every hand folded)