Move query to declaration