Minor cleanup. Added checks for row-vector and matrix values of xind.