Branch Query Logic