improved model, added cleaning up when model object removed