Latest Code for Trainer tool with fixes for dragging