new features for boundry edges and BPA iterating, outsourced code parts to validate a possible triangle