fixing gibbs
reducing intermediate variables
Merge branches 'master' and 'removing-intermediate-variables'