Optimize gss using 2d vars and bloc chaining