Solver for looping script