complete implementing savefunc