Updated save code - at the moment not functional