Further updates to model logic, plus debugging