Re-inlined the save function.