Fix potential gotcha in item removal.

Also, move all the logic code into the model.