added test_infer and moved stuff from model to it