Added random segment tests. Added a few more examples. Updated algorithm to pass random tests. Updated predicates.