fix bug
_model is now a scoped_ptr (really, this looks like a PIMPL)
fix memory leak
add assert()s
move a few global functions from Model to AppInstance, get rid of getModel() (we shpuld also get rid of getGui() and getApp() everywhere)