the increment of s0 was corrected to the right line. Other minor changes as well
minor changes ...close at the end to close figure-window upon completion