abstracted our save function and documented like awesome peopel