adding train-test functionality