Added support for an arbitrary number of bodies and constraints