Add train and test mode