automatically calculate the required number of iterations
move window creation into the renderer