Made convex library methods more general.