diff --git a/xos/api/tenant/cord/subscriber.py b/xos/api/tenant/cord/subscriber.py
index b85c634..490e1af 100644
--- a/xos/api/tenant/cord/subscriber.py
+++ b/xos/api/tenant/cord/subscriber.py
@@ -45,21 +45,26 @@
         self.enable_uverse = value.get("uverse", self.get_default_attribute("enable_uverse"))
         self.status = value.get("status", self.get_default_attribute("status"))
 
+    def update_features(self, value):
+        d=self.features
+        d.update(value)
+        self.features = d
+
     def save(self, *args, **kwargs):
         super(CordSubscriberNew, self).save(*args, **kwargs)
 
-#class FeatureSerializer(serializers.Serializer):
-#    cdn = serializers.BooleanField()
-#    uplink_speed = serializers.IntegerField()
-#    downlink_speed = serializers.IntegerField()
-#    uverse = serializers.BooleanField()
-#    status = serializers.CharField()
+class FeatureSerializer(serializers.Serializer):
+    cdn = serializers.BooleanField(required=False)
+    uplink_speed = serializers.IntegerField(required=False)
+    downlink_speed = serializers.IntegerField(required=False)
+    uverse = serializers.BooleanField(required=False)
+    status = serializers.CharField(required=False)
 
 class CordSubscriberSerializer(serializers.ModelSerializer, PlusSerializerMixin):
         id = ReadOnlyField()
         service_specific_id = ReadOnlyField()
         humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-        features = serializers.DictField()
+        features = FeatureSerializer() # serializers.DictField()
 
         class Meta:
             model = CordSubscriberNew
@@ -95,27 +100,32 @@
 
         serializer = self.get_serializer(object_list, many=True)
 
-        return Response({"subscribers": serializer.data})
+        return Response(serializer.data)
 
     def get_features(self, request, pk=None):
         subscriber = self.get_object()
-        return Response(subscriber.features)
+        return Response(FeatureSerializer(subscriber.features).data)
 
     def get_feature(self, request, pk=None, feature=None):
         subscriber = self.get_object()
-        return Response(subscriber.features[feature])
+        return Response({feature: FeatureSerializer(subscriber.features).data[feature]})
 
     def set_feature(self, request, pk=None, feature=None):
         subscriber = self.get_object()
-        subscriber.features[feature] = request.data
-        print "XXX", request.DATA
+        if [feature] != request.data.keys():
+             raise serializers.ValidationError("feature %s does not match keys in request body (%s)" % (feature, ",".join(request.data.keys())))
+        ser = FeatureSerializer(subscriber.features, data=request.data)
+        ser.is_valid(raise_exception = True)
+        subscriber.update_features(ser.validated_data)
         return Response(subscriber.features[feature])
 
     def set_features(self, request, pk=None):
         subscriber = self.get_object()
-        for k in subscriber.features:
-            subscriber.features[k] = request.data.get(k, subscriber.features[k])
-        return Response(subscriber.features[feature])
+        ser = FeatureSerializer(subscriber.features, data=request.data)
+        ser.is_valid(raise_exception = True)
+        subscriber.update_features(ser.validated_data)
+        subscriber.save()
+        return Response(FeatureSerializer(subscriber.features).data)
 
     def ssidlist(self, request):
         object_list = CordSubscriberNew.get_tenant_objects().all()
