added ability to specify the destination index