added figure removal functionality