moved external scripts into internal