added most functionality except uploading documents