authenticate method changed
some query reorganization