made func_train scalable