Externalized trains JS