New algorithm for overhang detection