Moved all globals into a model object.