Ldap refactor