Moved query to head section