Corrected script to work without extra joints.