More work on gibbs minimization.  Not remotely working