Added agreements model, plus references bug fix, etc