Model validation: splitted the model validation function into three separate functions.