Refactored part 1 queries