refactored, consolidated queries