Added function to determine the model execution order.  Added tests.