move main to variables, add a preload js file