Now with credential checking and unwrapping query results