A bunch of fixes to the model