sort out the search and query structure, fix doctype