diff --git a/pkg/db/backend.go b/pkg/db/backend.go
index f595dc1..1e23a0f 100644
--- a/pkg/db/backend.go
+++ b/pkg/db/backend.go
@@ -47,7 +47,7 @@
 }
 
 // NewBackend creates a new instance of a Backend structure
-func NewBackend(ctx context.Context, storeType string, address string, timeout time.Duration, pathPrefix string) *Backend {
+func NewBackend(storeType string, address string, timeout time.Duration, pathPrefix string) *Backend {
 	var err error
 
 	b := &Backend{
@@ -59,8 +59,8 @@
 		alive:                   false, // connection considered down at start
 	}
 
-	if b.Client, err = b.newClient(ctx, address, timeout); err != nil {
-		logger.Errorw(ctx, "failed-to-create-kv-client",
+	if b.Client, err = b.newClient(address, timeout); err != nil {
+		logger.Errorw("failed-to-create-kv-client",
 			log.Fields{
 				"type": storeType, "address": address,
 				"timeout": timeout, "prefix": pathPrefix,
@@ -71,22 +71,22 @@
 	return b
 }
 
-func (b *Backend) newClient(ctx context.Context, address string, timeout time.Duration) (kvstore.Client, error) {
+func (b *Backend) newClient(address string, timeout time.Duration) (kvstore.Client, error) {
 	switch b.StoreType {
 	case "consul":
-		return kvstore.NewConsulClient(ctx, address, timeout)
+		return kvstore.NewConsulClient(address, timeout)
 	case "etcd":
-		return kvstore.NewEtcdClient(ctx, address, timeout, log.WarnLevel)
+		return kvstore.NewEtcdClient(address, timeout, log.WarnLevel)
 	}
 	return nil, errors.New("unsupported-kv-store")
 }
 
-func (b *Backend) makePath(ctx context.Context, key string) string {
+func (b *Backend) makePath(key string) string {
 	path := fmt.Sprintf("%s/%s", b.PathPrefix, key)
 	return path
 }
 
-func (b *Backend) updateLiveness(ctx context.Context, alive bool) {
+func (b *Backend) updateLiveness(alive bool) {
 	// Periodically push stream of liveness data to the channel,
 	// so that in a live state, the core does not timeout and
 	// send a forced liveness message. Push alive state if the
@@ -94,11 +94,11 @@
 	if b.liveness != nil {
 
 		if b.alive != alive {
-			logger.Debug(ctx, "update-liveness-channel-reason-change")
+			logger.Debug("update-liveness-channel-reason-change")
 			b.liveness <- alive
 			b.lastLivenessTime = time.Now()
 		} else if time.Since(b.lastLivenessTime) > b.LivenessChannelInterval {
-			logger.Debug(ctx, "update-liveness-channel-reason-interval")
+			logger.Debug("update-liveness-channel-reason-interval")
 			b.liveness <- alive
 			b.lastLivenessTime = time.Now()
 		}
@@ -106,7 +106,7 @@
 
 	// Emit log message only for alive state change
 	if b.alive != alive {
-		logger.Debugw(ctx, "change-kvstore-alive-status", log.Fields{"alive": alive})
+		logger.Debugw("change-kvstore-alive-status", log.Fields{"alive": alive})
 		b.alive = alive
 	}
 }
@@ -115,9 +115,9 @@
 // post on Liveness channel
 func (b *Backend) PerformLivenessCheck(ctx context.Context) bool {
 	alive := b.Client.IsConnectionUp(ctx)
-	logger.Debugw(ctx, "kvstore-liveness-check-result", log.Fields{"alive": alive})
+	logger.Debugw("kvstore-liveness-check-result", log.Fields{"alive": alive})
 
-	b.updateLiveness(ctx, alive)
+	b.updateLiveness(alive)
 	return alive
 }
 
@@ -126,11 +126,11 @@
 // or not the connection is still Live. This channel is then picked up
 // by the service (i.e. rw_core / ro_core) to update readiness status
 // and/or take other actions.
-func (b *Backend) EnableLivenessChannel(ctx context.Context) chan bool {
-	logger.Debug(ctx, "enable-kvstore-liveness-channel")
+func (b *Backend) EnableLivenessChannel() chan bool {
+	logger.Debug("enable-kvstore-liveness-channel")
 
 	if b.liveness == nil {
-		logger.Debug(ctx, "create-kvstore-liveness-channel")
+		logger.Debug("create-kvstore-liveness-channel")
 
 		// Channel size of 10 to avoid any possibility of blocking in Load conditions
 		b.liveness = make(chan bool, 10)
@@ -144,7 +144,7 @@
 }
 
 // Extract Alive status of Kvstore based on type of error
-func (b *Backend) isErrorIndicatingAliveKvstore(ctx context.Context, err error) bool {
+func (b *Backend) isErrorIndicatingAliveKvstore(err error) bool {
 	// Alive unless observed an error indicating so
 	alive := true
 
@@ -182,64 +182,64 @@
 
 // List retrieves one or more items that match the specified key
 func (b *Backend) List(ctx context.Context, key string) (map[string]*kvstore.KVPair, error) {
-	formattedPath := b.makePath(ctx, key)
-	logger.Debugw(ctx, "listing-key", log.Fields{"key": key, "path": formattedPath})
+	formattedPath := b.makePath(key)
+	logger.Debugw("listing-key", log.Fields{"key": key, "path": formattedPath})
 
 	pair, err := b.Client.List(ctx, formattedPath)
 
-	b.updateLiveness(ctx, b.isErrorIndicatingAliveKvstore(ctx, err))
+	b.updateLiveness(b.isErrorIndicatingAliveKvstore(err))
 
 	return pair, err
 }
 
 // Get retrieves an item that matches the specified key
 func (b *Backend) Get(ctx context.Context, key string) (*kvstore.KVPair, error) {
-	formattedPath := b.makePath(ctx, key)
-	logger.Debugw(ctx, "getting-key", log.Fields{"key": key, "path": formattedPath})
+	formattedPath := b.makePath(key)
+	logger.Debugw("getting-key", log.Fields{"key": key, "path": formattedPath})
 
 	pair, err := b.Client.Get(ctx, formattedPath)
 
-	b.updateLiveness(ctx, b.isErrorIndicatingAliveKvstore(ctx, err))
+	b.updateLiveness(b.isErrorIndicatingAliveKvstore(err))
 
 	return pair, err
 }
 
 // Put stores an item value under the specifed key
 func (b *Backend) Put(ctx context.Context, key string, value interface{}) error {
-	formattedPath := b.makePath(ctx, key)
-	logger.Debugw(ctx, "putting-key", log.Fields{"key": key, "path": formattedPath})
+	formattedPath := b.makePath(key)
+	logger.Debugw("putting-key", log.Fields{"key": key, "path": formattedPath})
 
 	err := b.Client.Put(ctx, formattedPath, value)
 
-	b.updateLiveness(ctx, b.isErrorIndicatingAliveKvstore(ctx, err))
+	b.updateLiveness(b.isErrorIndicatingAliveKvstore(err))
 
 	return err
 }
 
 // Delete removes an item under the specified key
 func (b *Backend) Delete(ctx context.Context, key string) error {
-	formattedPath := b.makePath(ctx, key)
-	logger.Debugw(ctx, "deleting-key", log.Fields{"key": key, "path": formattedPath})
+	formattedPath := b.makePath(key)
+	logger.Debugw("deleting-key", log.Fields{"key": key, "path": formattedPath})
 
 	err := b.Client.Delete(ctx, formattedPath)
 
-	b.updateLiveness(ctx, b.isErrorIndicatingAliveKvstore(ctx, err))
+	b.updateLiveness(b.isErrorIndicatingAliveKvstore(err))
 
 	return err
 }
 
 // CreateWatch starts watching events for the specified key
 func (b *Backend) CreateWatch(ctx context.Context, key string, withPrefix bool) chan *kvstore.Event {
-	formattedPath := b.makePath(ctx, key)
-	logger.Debugw(ctx, "creating-key-watch", log.Fields{"key": key, "path": formattedPath})
+	formattedPath := b.makePath(key)
+	logger.Debugw("creating-key-watch", log.Fields{"key": key, "path": formattedPath})
 
 	return b.Client.Watch(ctx, formattedPath, withPrefix)
 }
 
 // DeleteWatch stops watching events for the specified key
-func (b *Backend) DeleteWatch(ctx context.Context, key string, ch chan *kvstore.Event) {
-	formattedPath := b.makePath(ctx, key)
-	logger.Debugw(ctx, "deleting-key-watch", log.Fields{"key": key, "path": formattedPath})
+func (b *Backend) DeleteWatch(key string, ch chan *kvstore.Event) {
+	formattedPath := b.makePath(key)
+	logger.Debugw("deleting-key-watch", log.Fields{"key": key, "path": formattedPath})
 
-	b.Client.CloseWatch(ctx, formattedPath, ch)
+	b.Client.CloseWatch(formattedPath, ch)
 }
