cleaned up some of the code used to check if the model is valid or not - now it uses the full model as well