added new apply function to allow model paths to be used instead of model objects