moved scripts to mainLoop