refactor ldap