Reorder scripts to meet all interdependencies