Added save function (untested).