minor edits, queries doc
conflicts reso
put db query at right place