updated external query