Updated save code