Added the WriteStackReg method