replaced LDAP code