added javadoc; streamlined code; implemented deleteDocument