Allow more flexible query options - fixes #188.