Algorithm to fill disconnected chambers