Changed location of figure clear calls