write up robust version of birthday query