Implemented execution order determination algorithm