initialize variables, loop, JS calls