The complexity of this query makes me nervous. Also, constants to the top please.