renamed model->agent and other tweaks