Query test improvements & minor refactoring

private/protected?