Updated directory logic to add/fetch all gateways