Adding saveObjFig and stack coding