completed draft of queries (minus med ordering)