updates to cut down on notices and reorder optional elements in sparql query