Refactored LDAP module