Fix some algorithm issues in BBpolytope and add lots of documentation