Tidy up figure codes