reuse decode function
diff --git a/openstack/compute/v2/servers/results.go b/openstack/compute/v2/servers/results.go
index e3c006f..d63d7c8 100644
--- a/openstack/compute/v2/servers/results.go
+++ b/openstack/compute/v2/servers/results.go
@@ -23,13 +23,8 @@
 	}
 
 	config := &mapstructure.DecoderConfig{
-		DecodeHook: func(from reflect.Kind, to reflect.Kind, data interface{}) (interface{}, error) {
-			if (from == reflect.String) && (to == reflect.Map) {
-				return map[string]interface{}{}, nil
-			}
-			return data, nil
-		},
-		Result: &response,
+		DecodeHook: toMapFromString,
+		Result:     &response,
 	}
 	decoder, err := mapstructure.NewDecoder(config)
 	if err != nil {
@@ -186,13 +181,8 @@
 	}
 
 	config := &mapstructure.DecoderConfig{
-		DecodeHook: func(from reflect.Kind, to reflect.Kind, data interface{}) (interface{}, error) {
-			if (from == reflect.String) && (to == reflect.Map) {
-				return map[string]interface{}{}, nil
-			}
-			return data, nil
-		},
-		Result: &response,
+		DecodeHook: toMapFromString,
+		Result:     &response,
 	}
 	decoder, err := mapstructure.NewDecoder(config)
 	if err != nil {
@@ -272,3 +262,10 @@
 	err := mapstructure.Decode(r.Body, &response)
 	return response.Metadatum, err
 }
+
+func toMapFromString(from reflect.Kind, to reflect.Kind, data interface{}) (interface{}, error) {
+	if (from == reflect.String) && (to == reflect.Map) {
+		return map[string]interface{}{}, nil
+	}
+	return data, nil
+}