Updated query to reflect API changes; added test.