Working draft of training sample retrieval script.