Now with retraining logic and new command line option