I strongly feel the original library is a perfect example of overengineering (sorry), so I did this simplified version here. It just does the online insertion part, without flipping and sorting. Implement your own heuristics on top of it (inserting by descending order of area/max length, etc.)