Completed first version of document save