added figure handles and conditions specific to the gui (debug = 11)