Dynamic route-based scripts with reference to main'