[XAPID-1037] refactor | make object based methods
diff --git a/api.go b/api.go
index 07ecacd..57aae9b 100644
--- a/api.go
+++ b/api.go
@@ -133,7 +133,7 @@
 		return errResponse, err
 	}
 
-	apiM.enrichAttributes(dataWrapper)
+	apiM.enrichAttributes(&dataWrapper)
 
 	if dataWrapper.ctype == "developer" {
 		dataWrapper.verifyApiKeySuccessResponse.Developer = dataWrapper.tempDeveloperDetails
@@ -217,7 +217,7 @@
 	return false
 }
 
-func (a *apiManager) enrichAttributes(dataWrapper VerifyApiKeyRequestResponseDataWrapper) {
+func (a *apiManager) enrichAttributes(dataWrapper *VerifyApiKeyRequestResponseDataWrapper) {
 	clientIdAttributes := a.dbMan.getKmsAttributes(dataWrapper.tenant_id, dataWrapper.verifyApiKeySuccessResponse.ClientId.ClientId)
 	developerAttributes := a.dbMan.getKmsAttributes(dataWrapper.tenant_id, dataWrapper.tempDeveloperDetails.Id)
 	appAttributes := a.dbMan.getKmsAttributes(dataWrapper.tenant_id, dataWrapper.verifyApiKeySuccessResponse.App.Id)
diff --git a/data.go b/data.go
index 47581c0..ffb5811 100644
--- a/data.go
+++ b/data.go
@@ -15,12 +15,9 @@
 
 import (
 	"database/sql"
-	"encoding/json"
 	"errors"
 	"github.com/30x/apid-core"
-	"strings"
 	"sync"
-	"unicode/utf8"
 )
 
 type dbManager struct {
@@ -274,22 +271,9 @@
 		return err
 	}
 
-	if err := json.Unmarshal([]byte(proxies), &dataWrapper.verifyApiKeySuccessResponse.ApiProduct.Apiproxies); err != nil {
-		log.Debug("unmarshall error for proxies, performing custom unmarshal ", proxies, err)
-
-		dataWrapper.verifyApiKeySuccessResponse.ApiProduct.Apiproxies = splitMalformedJson(proxies)
-
-	}
-	if err := json.Unmarshal([]byte(environments), &dataWrapper.verifyApiKeySuccessResponse.ApiProduct.Environments); err != nil {
-		log.Debug("unmarshall error for proxies, performing custom unmarshal ", environments, err)
-		dataWrapper.verifyApiKeySuccessResponse.ApiProduct.Environments = splitMalformedJson(environments)
-
-	}
-	if err := json.Unmarshal([]byte(resources), &dataWrapper.verifyApiKeySuccessResponse.ApiProduct.Resources); err != nil {
-		log.Debug("unmarshall error for proxies, performing custom unmarshal ", resources, err)
-		dataWrapper.verifyApiKeySuccessResponse.ApiProduct.Resources = splitMalformedJson(resources)
-
-	}
+	dataWrapper.verifyApiKeySuccessResponse.ApiProduct.Apiproxies = jsonToStringArray(proxies)
+	dataWrapper.verifyApiKeySuccessResponse.ApiProduct.Environments = jsonToStringArray(environments)
+	dataWrapper.verifyApiKeySuccessResponse.ApiProduct.Resources = jsonToStringArray(resources)
 
 	if dataWrapper.verifyApiKeySuccessResponse.App.CallbackUrl != "" {
 		dataWrapper.verifyApiKeySuccessResponse.ClientId.RedirectURIs = []string{dataWrapper.verifyApiKeySuccessResponse.App.CallbackUrl}
@@ -299,13 +283,3 @@
 
 	return err
 }
-
-func splitMalformedJson(fjson string) []string {
-	var fs []string
-	s := strings.TrimPrefix(fjson, "{")
-	s = strings.TrimSuffix(s, "}")
-	if utf8.RuneCountInString(s) > 0 {
-		fs = strings.Split(s, ",")
-	}
-	return fs
-}
diff --git a/validate_env.go b/validate_env.go
deleted file mode 100644
index 5b1dc4c..0000000
--- a/validate_env.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2017 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package apidVerifyApiKey
-
-import "strings"
-
-/*
- * Ensure the ENV matches.
- */
-func validateEnv(envLocal string, envInPath string) bool {
-	if envInPath == "" {
-		return false
-	}
-	s := strings.TrimPrefix(envLocal, "{")
-	s = strings.TrimSuffix(s, "}")
-	fs := strings.Split(s, ",")
-	for _, a := range fs {
-		if a == envInPath {
-			return true
-		}
-	}
-	return false
-}
diff --git a/validate_path.go b/verifyApiKeyUtil.go
similarity index 68%
rename from validate_path.go
rename to verifyApiKeyUtil.go
index c03080f..33ec5aa 100644
--- a/validate_path.go
+++ b/verifyApiKeyUtil.go
@@ -15,10 +15,27 @@
 package apidVerifyApiKey
 
 import (
+	"encoding/json"
 	"regexp"
 	"strings"
+	"unicode/utf8"
 )
 
+func validateEnv(envLocal string, envInPath string) bool {
+	if envInPath == "" {
+		return false
+	}
+	s := strings.TrimPrefix(envLocal, "{")
+	s = strings.TrimSuffix(s, "}")
+	fs := strings.Split(s, ",")
+	for _, a := range fs {
+		if a == envInPath {
+			return true
+		}
+	}
+	return false
+}
+
 /*
  * Check for the base path (API_Product) match with the path
  * received in the Request, via the customized regex, where
@@ -53,3 +70,17 @@
 	/* if the i/p resource is empty, no checks need to be made */
 	return len(fs) == 0
 }
+
+func jsonToStringArray(fjson string) []string {
+	var array []string
+	if err := json.Unmarshal([]byte(fjson), array); err == nil {
+		return array
+	}
+	log.Debug("unmarshall error for string, performing custom unmarshal ", fjson)
+	s := strings.TrimPrefix(fjson, "{")
+	s = strings.TrimSuffix(s, "}")
+	if utf8.RuneCountInString(s) > 0 {
+		array = strings.Split(s, ",")
+	}
+	return array
+}