reduced all queries to 3, thanks to Safra for his help