Adjusted joint limit function for the number of optimized torques + couple of renaming edits