diff --git a/demo_test/Makefile b/demo_test/Makefile
index d2d3ced..533ef3a 100644
--- a/demo_test/Makefile
+++ b/demo_test/Makefile
@@ -24,6 +24,7 @@
 
 
 proto/importer.pb.go: ../proto/importer.proto
+	mkdir -p proto
 	protoc --proto_path=../proto \
 	-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
 	--go_out=plugins=grpc:proto/ \
diff --git a/demo_test/cmd_client/Note b/demo_test/cmd_client/Note
index 74b6916..ca0c094 100644
--- a/demo_test/cmd_client/Note
+++ b/demo_test/cmd_client/Note
@@ -52,44 +52,48 @@
 									attach:192.168.4.27:8888:edgecore:180
 									attach:192.168.3.34:8888:edgecore:180
 --------------------------------------------------------------------------------------
-UnSubscribe all events(ResourceAdded/ResourceRemoved/Alert)		unsub:add:rm:alert
+UnSubscribe all events(ResourceAdded/ResourceRemoved/Alert)		unsub:192.168.4.27:8888:add:rm:alert
 --------------------------------------------------------------------------------------
-Subscribe all events(ResourceAdded/ResourceRemoved/Alert) 		sub:add:rm:alert
+Subscribe all events(ResourceAdded/ResourceRemoved/Alert) 		sub:192.168.4.27:8888:add:rm:alert
 --------------------------------------------------------------------------------------
 Subscribe and unsubscribe an event					Example:	
 
-Subscribe ResourceAdded event 						sub:add
-Subscribe ResourceRemoved event						sub:rm
-Subscribe Alert event							sub:alert
-Unsubscribe ResourceAdded event						unsub:add
-Unsubscribe ResourceRemoved event					unsub:rm
-Unsubscribe Alert event							unsub:alert
+Subscribe ResourceAdded event 						sub:192.168.4.27:8888:add
+Subscribe ResourceRemoved event						sub:192.168.4.27:8888:rm
+Subscribe Alert event							sub:192.168.4.27:8888:alert
+Unsubscribe ResourceAdded event						unsub:192.168.4.27:8888:add
+Unsubscribe ResourceRemoved event					unsub:192.168.4.27:8888:rm
+Unsubscribe Alert event							unsub:192.168.4.27:8888:alert
 --------------------------------------------------------------------------------------
 Subscribe and unsubscribe multiple events, out of order			Use the above commands to do test.
 --------------------------------------------------------------------------------------
-Subscribe an unsupported event						sub:update
+Subscribe an unsupported event						sub:192.168.4.27:8888:update
 --------------------------------------------------------------------------------------
 Subscribe to an already subscribed event				Example:
 
-									sub:add
-									sub:add
+									sub:192.168.4.27:8888:add
+									sub:192.168.4.27:8888:add
 --------------------------------------------------------------------------------------
-Unsubscribe  an unsupported event					unsub:update
+Unsubscribe  an unsupported event					unsub:192.168.4.27:8888:update
 --------------------------------------------------------------------------------------
 Unsubscribe a supported but not-subscribed event			Example:
 
-									unsub:add:rm:alert
-									unsub:add
-									unsub:rm
-									unsub:alert
+									unsub:192.168.4.27:8888:add:rm:alert
+									unsub:192.168.4.27:8888:add
+									unsub:192.168.4.27:8888:rm
+									unsub:192.168.4.27:8888:alert
 --------------------------------------------------------------------------------------
 Change polling interval 						Example: 
 
 Set frequecny to 30 seconds
-									period:30
+									period:192.168.4.27:8888:30
 --------------------------------------------------------------------------------------
-Show support event list							showeventlist	
---------------------------------------------------------------------------------------
+Show support event list vendor						showeventlist:edgecore
+-----------------------------------------------------------------------------------------------
+Show current events subscribed by device                               showdeviceeventlist:192.168.4.27:8888
+------------------------------------------------------------------------------------------------------------ 
+Clear all current events subscribed by device                          cleardeviceeventlist:192.168.4.27:8888
+-------------------------------------------------------------------------------------------------------------
 * During and after each test, verify the list of events subscribed	wget --no-check-certificate  \
 									-qO- https://192.168.4.27:8888/redfish/v1/EventService/Subscriptions/ \
 									| python -m json.tool
diff --git a/demo_test/proto/importer.pb.go b/demo_test/proto/importer.pb.go
deleted file mode 100644
index 0e2fe6a..0000000
--- a/demo_test/proto/importer.pb.go
+++ /dev/null
@@ -1,432 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: importer.proto
-
-package importer
-
-import (
-	context "context"
-	fmt "fmt"
-	proto "github.com/golang/protobuf/proto"
-	empty "github.com/golang/protobuf/ptypes/empty"
-	grpc "google.golang.org/grpc"
-	codes "google.golang.org/grpc/codes"
-	status "google.golang.org/grpc/status"
-	math "math"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
-type DeviceInfo struct {
-	IpAddress            string   `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"`
-	Frequency            uint32   `protobuf:"varint,2,opt,name=frequency,proto3" json:"frequency,omitempty"`
-	Vendor               string   `protobuf:"bytes,3,opt,name=vendor,proto3" json:"vendor,omitempty"`
-	Protocol             string   `protobuf:"bytes,4,opt,name=protocol,proto3" json:"protocol,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *DeviceInfo) Reset()         { *m = DeviceInfo{} }
-func (m *DeviceInfo) String() string { return proto.CompactTextString(m) }
-func (*DeviceInfo) ProtoMessage()    {}
-func (*DeviceInfo) Descriptor() ([]byte, []int) {
-	return fileDescriptor_394990ff89e0d02b, []int{0}
-}
-
-func (m *DeviceInfo) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_DeviceInfo.Unmarshal(m, b)
-}
-func (m *DeviceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_DeviceInfo.Marshal(b, m, deterministic)
-}
-func (m *DeviceInfo) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_DeviceInfo.Merge(m, src)
-}
-func (m *DeviceInfo) XXX_Size() int {
-	return xxx_messageInfo_DeviceInfo.Size(m)
-}
-func (m *DeviceInfo) XXX_DiscardUnknown() {
-	xxx_messageInfo_DeviceInfo.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_DeviceInfo proto.InternalMessageInfo
-
-func (m *DeviceInfo) GetIpAddress() string {
-	if m != nil {
-		return m.IpAddress
-	}
-	return ""
-}
-
-func (m *DeviceInfo) GetFrequency() uint32 {
-	if m != nil {
-		return m.Frequency
-	}
-	return 0
-}
-
-func (m *DeviceInfo) GetVendor() string {
-	if m != nil {
-		return m.Vendor
-	}
-	return ""
-}
-
-func (m *DeviceInfo) GetProtocol() string {
-	if m != nil {
-		return m.Protocol
-	}
-	return ""
-}
-
-type EventList struct {
-	EventIpAddress       string   `protobuf:"bytes,1,opt,name=event_ip_address,json=eventIpAddress,proto3" json:"event_ip_address,omitempty"`
-	Events               []string `protobuf:"bytes,2,rep,name=events,proto3" json:"events,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *EventList) Reset()         { *m = EventList{} }
-func (m *EventList) String() string { return proto.CompactTextString(m) }
-func (*EventList) ProtoMessage()    {}
-func (*EventList) Descriptor() ([]byte, []int) {
-	return fileDescriptor_394990ff89e0d02b, []int{1}
-}
-
-func (m *EventList) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_EventList.Unmarshal(m, b)
-}
-func (m *EventList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_EventList.Marshal(b, m, deterministic)
-}
-func (m *EventList) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_EventList.Merge(m, src)
-}
-func (m *EventList) XXX_Size() int {
-	return xxx_messageInfo_EventList.Size(m)
-}
-func (m *EventList) XXX_DiscardUnknown() {
-	xxx_messageInfo_EventList.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_EventList proto.InternalMessageInfo
-
-func (m *EventList) GetEventIpAddress() string {
-	if m != nil {
-		return m.EventIpAddress
-	}
-	return ""
-}
-
-func (m *EventList) GetEvents() []string {
-	if m != nil {
-		return m.Events
-	}
-	return nil
-}
-
-type SupportedEventList struct {
-	Events               []string `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *SupportedEventList) Reset()         { *m = SupportedEventList{} }
-func (m *SupportedEventList) String() string { return proto.CompactTextString(m) }
-func (*SupportedEventList) ProtoMessage()    {}
-func (*SupportedEventList) Descriptor() ([]byte, []int) {
-	return fileDescriptor_394990ff89e0d02b, []int{2}
-}
-
-func (m *SupportedEventList) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_SupportedEventList.Unmarshal(m, b)
-}
-func (m *SupportedEventList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_SupportedEventList.Marshal(b, m, deterministic)
-}
-func (m *SupportedEventList) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_SupportedEventList.Merge(m, src)
-}
-func (m *SupportedEventList) XXX_Size() int {
-	return xxx_messageInfo_SupportedEventList.Size(m)
-}
-func (m *SupportedEventList) XXX_DiscardUnknown() {
-	xxx_messageInfo_SupportedEventList.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_SupportedEventList proto.InternalMessageInfo
-
-func (m *SupportedEventList) GetEvents() []string {
-	if m != nil {
-		return m.Events
-	}
-	return nil
-}
-
-func init() {
-	proto.RegisterType((*DeviceInfo)(nil), "importer.DeviceInfo")
-	proto.RegisterType((*EventList)(nil), "importer.EventList")
-	proto.RegisterType((*SupportedEventList)(nil), "importer.SupportedEventList")
-}
-
-func init() { proto.RegisterFile("importer.proto", fileDescriptor_394990ff89e0d02b) }
-
-var fileDescriptor_394990ff89e0d02b = []byte{
-	// 329 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x90, 0xcf, 0x4a, 0xf3, 0x40,
-	0x14, 0xc5, 0x9b, 0xf6, 0xa3, 0x34, 0x97, 0x7e, 0x45, 0x47, 0xad, 0xa1, 0x56, 0x28, 0x59, 0x75,
-	0x21, 0x29, 0xe8, 0x5e, 0x14, 0xfa, 0xc7, 0x82, 0x6e, 0x1a, 0x5c, 0x97, 0x26, 0xb9, 0x2d, 0x03,
-	0xcd, 0xcc, 0x38, 0x33, 0x09, 0x74, 0xe1, 0x23, 0xfb, 0x0e, 0x92, 0x89, 0xcd, 0x14, 0x2a, 0x82,
-	0xe0, 0xf2, 0xfc, 0xe6, 0x9e, 0xb9, 0xe7, 0x1e, 0xe8, 0xd0, 0x54, 0x70, 0xa9, 0x51, 0x06, 0x42,
-	0x72, 0xcd, 0x49, 0x6b, 0xaf, 0x7b, 0x57, 0x1b, 0xce, 0x37, 0x5b, 0x1c, 0x19, 0x1e, 0x65, 0xeb,
-	0x11, 0xa6, 0x42, 0xef, 0xca, 0x31, 0xff, 0x1d, 0x60, 0x8c, 0x39, 0x8d, 0x71, 0xce, 0xd6, 0x9c,
-	0x5c, 0x03, 0x50, 0xb1, 0x5c, 0x25, 0x89, 0x44, 0xa5, 0x3c, 0x67, 0xe0, 0x0c, 0xdd, 0x85, 0x4b,
-	0xc5, 0x63, 0x09, 0x48, 0x1f, 0xdc, 0xb5, 0xc4, 0xb7, 0x0c, 0x59, 0xbc, 0xf3, 0xea, 0x03, 0x67,
-	0xf8, 0x7f, 0x61, 0x01, 0xe9, 0x42, 0x33, 0x47, 0x96, 0x70, 0xe9, 0x35, 0x8c, 0xf1, 0x4b, 0x91,
-	0x1e, 0xb4, 0xcc, 0xae, 0x98, 0x6f, 0xbd, 0x7f, 0xe6, 0xa5, 0xd2, 0xfe, 0x0b, 0xb8, 0x93, 0x1c,
-	0x99, 0x7e, 0xa6, 0x4a, 0x93, 0x21, 0x9c, 0x60, 0x21, 0x96, 0x47, 0x19, 0x3a, 0x86, 0xcf, 0xab,
-	0x20, 0x5d, 0x68, 0x1a, 0xa2, 0xbc, 0xfa, 0xa0, 0x51, 0xac, 0x2a, 0x95, 0x7f, 0x03, 0x24, 0xcc,
-	0x84, 0xb9, 0x3b, 0xb1, 0xff, 0xda, 0x69, 0xe7, 0x70, 0xfa, 0xf6, 0xa3, 0x0e, 0xa7, 0x89, 0x39,
-	0x7e, 0x99, 0xae, 0xd8, 0x6a, 0x83, 0x29, 0x32, 0x4d, 0x1e, 0xa0, 0x13, 0x22, 0x4b, 0x0e, 0x5a,
-	0x39, 0x0f, 0xaa, 0x6e, 0x2d, 0xed, 0x75, 0x83, 0xb2, 0xd7, 0x60, 0xdf, 0x6b, 0x30, 0x29, 0x7a,
-	0xf5, 0x6b, 0xe4, 0x1e, 0xda, 0x21, 0xea, 0x69, 0x55, 0xcc, 0x6f, 0xfd, 0x63, 0x68, 0xcf, 0x50,
-	0xdb, 0xfc, 0xdf, 0xfb, 0xfb, 0x96, 0x1e, 0xdf, 0xec, 0xd7, 0xc8, 0x14, 0x2e, 0xc2, 0x2c, 0x52,
-	0x32, 0x96, 0x34, 0xc2, 0x19, 0xcd, 0x91, 0x99, 0x57, 0x45, 0xce, 0xac, 0xb1, 0x9a, 0xff, 0x21,
-	0xcd, 0x13, 0x5c, 0xbe, 0xb2, 0xbf, 0xf8, 0x29, 0x6a, 0x1a, 0x72, 0xf7, 0x19, 0x00, 0x00, 0xff,
-	0xff, 0x79, 0x23, 0x4a, 0xc2, 0xab, 0x02, 0x00, 0x00,
-}
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ context.Context
-var _ grpc.ClientConn
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion4
-
-// DeviceManagementClient is the client API for DeviceManagement service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
-type DeviceManagementClient interface {
-	SendDeviceInfo(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error)
-	SetFrequency(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error)
-	GetEventList(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*SupportedEventList, error)
-	SubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error)
-	UnSubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error)
-}
-
-type deviceManagementClient struct {
-	cc *grpc.ClientConn
-}
-
-func NewDeviceManagementClient(cc *grpc.ClientConn) DeviceManagementClient {
-	return &deviceManagementClient{cc}
-}
-
-func (c *deviceManagementClient) SendDeviceInfo(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error) {
-	out := new(empty.Empty)
-	err := c.cc.Invoke(ctx, "/importer.device_management/SendDeviceInfo", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *deviceManagementClient) SetFrequency(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error) {
-	out := new(empty.Empty)
-	err := c.cc.Invoke(ctx, "/importer.device_management/SetFrequency", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *deviceManagementClient) GetEventList(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*SupportedEventList, error) {
-	out := new(SupportedEventList)
-	err := c.cc.Invoke(ctx, "/importer.device_management/GetEventList", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *deviceManagementClient) SubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error) {
-	out := new(empty.Empty)
-	err := c.cc.Invoke(ctx, "/importer.device_management/SubsrcribeGivenEvents", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *deviceManagementClient) UnSubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error) {
-	out := new(empty.Empty)
-	err := c.cc.Invoke(ctx, "/importer.device_management/UnSubsrcribeGivenEvents", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-// DeviceManagementServer is the server API for DeviceManagement service.
-type DeviceManagementServer interface {
-	SendDeviceInfo(context.Context, *DeviceInfo) (*empty.Empty, error)
-	SetFrequency(context.Context, *DeviceInfo) (*empty.Empty, error)
-	GetEventList(context.Context, *DeviceInfo) (*SupportedEventList, error)
-	SubsrcribeGivenEvents(context.Context, *EventList) (*empty.Empty, error)
-	UnSubsrcribeGivenEvents(context.Context, *EventList) (*empty.Empty, error)
-}
-
-// UnimplementedDeviceManagementServer can be embedded to have forward compatible implementations.
-type UnimplementedDeviceManagementServer struct {
-}
-
-func (*UnimplementedDeviceManagementServer) SendDeviceInfo(ctx context.Context, req *DeviceInfo) (*empty.Empty, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method SendDeviceInfo not implemented")
-}
-func (*UnimplementedDeviceManagementServer) SetFrequency(ctx context.Context, req *DeviceInfo) (*empty.Empty, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method SetFrequency not implemented")
-}
-func (*UnimplementedDeviceManagementServer) GetEventList(ctx context.Context, req *DeviceInfo) (*SupportedEventList, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method GetEventList not implemented")
-}
-func (*UnimplementedDeviceManagementServer) SubsrcribeGivenEvents(ctx context.Context, req *EventList) (*empty.Empty, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method SubsrcribeGivenEvents not implemented")
-}
-func (*UnimplementedDeviceManagementServer) UnSubsrcribeGivenEvents(ctx context.Context, req *EventList) (*empty.Empty, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method UnSubsrcribeGivenEvents not implemented")
-}
-
-func RegisterDeviceManagementServer(s *grpc.Server, srv DeviceManagementServer) {
-	s.RegisterService(&_DeviceManagement_serviceDesc, srv)
-}
-
-func _DeviceManagement_SendDeviceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(DeviceInfo)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(DeviceManagementServer).SendDeviceInfo(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/importer.device_management/SendDeviceInfo",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(DeviceManagementServer).SendDeviceInfo(ctx, req.(*DeviceInfo))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _DeviceManagement_SetFrequency_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(DeviceInfo)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(DeviceManagementServer).SetFrequency(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/importer.device_management/SetFrequency",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(DeviceManagementServer).SetFrequency(ctx, req.(*DeviceInfo))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _DeviceManagement_GetEventList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(DeviceInfo)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(DeviceManagementServer).GetEventList(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/importer.device_management/GetEventList",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(DeviceManagementServer).GetEventList(ctx, req.(*DeviceInfo))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _DeviceManagement_SubsrcribeGivenEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(EventList)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(DeviceManagementServer).SubsrcribeGivenEvents(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/importer.device_management/SubsrcribeGivenEvents",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(DeviceManagementServer).SubsrcribeGivenEvents(ctx, req.(*EventList))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _DeviceManagement_UnSubsrcribeGivenEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(EventList)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(DeviceManagementServer).UnSubsrcribeGivenEvents(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/importer.device_management/UnSubsrcribeGivenEvents",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(DeviceManagementServer).UnSubsrcribeGivenEvents(ctx, req.(*EventList))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-var _DeviceManagement_serviceDesc = grpc.ServiceDesc{
-	ServiceName: "importer.device_management",
-	HandlerType: (*DeviceManagementServer)(nil),
-	Methods: []grpc.MethodDesc{
-		{
-			MethodName: "SendDeviceInfo",
-			Handler:    _DeviceManagement_SendDeviceInfo_Handler,
-		},
-		{
-			MethodName: "SetFrequency",
-			Handler:    _DeviceManagement_SetFrequency_Handler,
-		},
-		{
-			MethodName: "GetEventList",
-			Handler:    _DeviceManagement_GetEventList_Handler,
-		},
-		{
-			MethodName: "SubsrcribeGivenEvents",
-			Handler:    _DeviceManagement_SubsrcribeGivenEvents_Handler,
-		},
-		{
-			MethodName: "UnSubsrcribeGivenEvents",
-			Handler:    _DeviceManagement_UnSubsrcribeGivenEvents_Handler,
-		},
-	},
-	Streams:  []grpc.StreamDesc{},
-	Metadata: "importer.proto",
-}
diff --git a/demo_test/test.go b/demo_test/test.go
index 70c2df6..05582ad 100644
--- a/demo_test/test.go
+++ b/demo_test/test.go
@@ -15,73 +15,61 @@
 package main
 
 import (
-        "fmt"
-        "net"
-        "bufio"
-        "os"
-        "os/signal"
-        "os/exec"
-        "github.com/Shopify/sarama"
-        "google.golang.org/grpc"
-        "golang.org/x/net/context"
-        importer "./proto"
-        log "github.com/Sirupsen/logrus"
+	importer "./proto"
+	"bufio"
 	"bytes"
+	"crypto/tls"
+	"fmt"
+	"github.com/Shopify/sarama"
+	log "github.com/Sirupsen/logrus"
+	"golang.org/x/net/context"
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/status"
+	"net"
+	"net/http"
+	"os"
+	"os/exec"
+	"os/signal"
+	"strconv"
 	"strings"
-        "net/http"
-        "crypto/tls"
-        "strconv"
 )
 
-var REDFISH_ROOT		= "/redfish/v1"
-var CONTENT_TYPE		= "application/json"
+var REDFISH_ROOT = "/redfish/v1"
+var CONTENT_TYPE = "application/json"
 var EVENTS_MAP = map[string]string{
-"add":"ResourceAdded",
-"rm":"ResourceRemoved",
-"alert":"Alert",
-"update":"Update"}
+	"add":    "ResourceAdded",
+	"rm":     "ResourceRemoved",
+	"alert":  "Alert",
+	"update": "Update"}
 
-var default_address string	= "localhost:31085"
-var default_port    string	= "8888"
-var default_vendor  string	= "edgecore"
-var default_freq    uint64	= 180
-var attach_device_ip string	= ""
-var importerTopic		= "importer"
+var default_address string = "localhost:31085"
+var default_port string = "8888"
+var default_vendor string = "edgecore"
+var default_freq uint64 = 180
+var attach_device_ip string = ""
+var importerTopic = "importer"
 var DataConsumer sarama.Consumer
 
-var cc	   importer.DeviceManagementClient
-var ctx	   context.Context
-var conn   * grpc.ClientConn
-
-type Device struct {
-	deviceinfo * importer.DeviceInfo
-	eventlist  * importer.EventList
-}
-
-var devicemap map[string]* Device
+var cc importer.DeviceManagementClient
+var ctx context.Context
+var conn *grpc.ClientConn
 
 /*///////////////////////////////////////////////////////////////////////*/
 // Allows user to register the device for data collection and frequency.
 //
 //
 /*///////////////////////////////////////////////////////////////////////*/
-func (s * Device) Attach(aip string, avendor string, afreq uint32) (error, string) {
-        fmt.Println("Received Attach\n")
-	var default_protocol string	= "https"
+func Attach(aip string, avendor string, afreq uint32) error {
+	fmt.Println("Received Attach\n")
+	var default_protocol string = "https"
+	deviceinfo := new(importer.DeviceInfo)
+	deviceinfo.IpAddress = aip
+	deviceinfo.Vendor = avendor
+	deviceinfo.Frequency = afreq
+	deviceinfo.Protocol = default_protocol
+	_, err := cc.SendDeviceInfo(ctx, deviceinfo)
 
-	s.deviceinfo = new(importer.DeviceInfo)
-	s.eventlist  = new(importer.EventList)
-	s.deviceinfo.IpAddress  = aip
-	s.deviceinfo.Vendor     = avendor
-	s.deviceinfo.Frequency  = afreq
-	s.deviceinfo.Protocol   = default_protocol
-	_, err := cc.SendDeviceInfo(ctx, s.deviceinfo)
-
-	if err != nil {
-		return err ,"attach error!!"
-	}else{
-		return nil,""
-	}
+	return err
 }
 
 /*///////////////////////////////////////////////////////////////////////*/
@@ -89,16 +77,14 @@
 //
 //
 /*///////////////////////////////////////////////////////////////////////*/
-func (s * Device) UpdateFreq(wd uint32)(error, string) {
-        fmt.Println("Received Period\n")
-	s.deviceinfo.Frequency  = wd
-	_, err := cc.SetFrequency(ctx, s.deviceinfo)
+func UpdateFreq(ip_address string, wd uint32) error {
+	fmt.Println("Received Period\n")
+	freqinfo := new(importer.FreqInfo)
+	freqinfo.Frequency = wd
+	freqinfo.IpAddress = ip_address
+	_, err := cc.SetFrequency(ctx, freqinfo)
 
-	if err != nil {
-		return err, "period error!!"
-	}else{
-		return nil,""
-	}
+	return err
 }
 
 /*///////////////////////////////////////////////////////////////////////*/
@@ -106,17 +92,14 @@
 //
 //
 /*///////////////////////////////////////////////////////////////////////*/
-func (s * Device) Subscribe(eventlist []string) (error, string) {
-        fmt.Println("Received Subscribe\n")
-	s.eventlist.Events = eventlist
-	s.eventlist.EventIpAddress = s.deviceinfo.IpAddress
-	_, err := cc.SubsrcribeGivenEvents(ctx, s.eventlist)
+func Subscribe(ip_address string, Giveneventlist []string) error {
+	fmt.Println("Received Subscribe\n")
+	giveneventlist := new(importer.GivenEventList)
+	giveneventlist.Events = Giveneventlist
+	giveneventlist.EventIpAddress = ip_address
+	_, err := cc.SubsrcribeGivenEvents(ctx, giveneventlist)
 
-	if err != nil {
-		return err, "sub error!!"
-	}else{
-		return nil,""
-	}
+	return err
 }
 
 /*///////////////////////////////////////////////////////////////////////*/
@@ -124,17 +107,14 @@
 //
 //
 /*///////////////////////////////////////////////////////////////////////*/
-func (s * Device) UnSubscribe(eventlist []string) (error, string) {
-        fmt.Println("Received UnSubscribe\n")
-	s.eventlist.Events = eventlist
-	s.eventlist.EventIpAddress = s.deviceinfo.IpAddress
-	_, err := cc.UnSubsrcribeGivenEvents(ctx, s.eventlist)
+func UnSubscribe(ip_address string, Giveneventlist []string) error {
+	fmt.Println("Received UnSubscribe\n")
+	giveneventlist := new(importer.GivenEventList)
+	giveneventlist.Events = Giveneventlist
+	giveneventlist.EventIpAddress = ip_address
+	_, err := cc.UnSubsrcribeGivenEvents(ctx, giveneventlist)
 
-	if err != nil {
-		return err, "unsub error!!"
-	}else{
-		return nil,""
-	}
+	return err
 }
 
 /*///////////////////////////////////////////////////////////////////////*/
@@ -142,23 +122,50 @@
 //
 //
 /*///////////////////////////////////////////////////////////////////////*/
-func (s * Device) GetEventSupportList() (error, []string) {
-        fmt.Println("Received GetEventSupportList\n")
-	var ret_msg * importer.SupportedEventList
-	ret_msg, err :=cc.GetEventList(ctx, devicemap[s.deviceinfo.IpAddress].deviceinfo);
-	if err != nil {
-		return err,ret_msg.Events
-	}else{
-		fmt.Println("show all event subs:", ret_msg)
-		return nil , ret_msg.Events
-	}
+func GetEventSupportList(vendor string) (error, []string) {
+	fmt.Println("Received GetEventSupportList\n")
+	vendorinfo := new(importer.VendorInfo)
+	vendorinfo.Vendor = vendor
+	var ret_msg *importer.EventList
+	ret_msg, err := cc.GetEventList(ctx, vendorinfo)
+
+	return err, ret_msg.Events
+}
+
+/*///////////////////////////////////////////////////////////////////////*/
+// Allows user to get the current events subscribed by device
+//
+//
+/*///////////////////////////////////////////////////////////////////////*/
+func GetEventCurrentDeviceList(ip_address string) (error, []string) {
+	fmt.Println("Received GetEventCurrentDeviceList\n")
+	currentdeviceinfo := new(importer.Device)
+	currentdeviceinfo.IpAddress = ip_address
+	var ret_msg *importer.EventList
+	ret_msg, err := cc.GetCurrentEventList(ctx, currentdeviceinfo)
+
+	return err, ret_msg.Events
+}
+
+/*///////////////////////////////////////////////////////////////////////*/
+// Allows user to get the current events subscribed by device
+//
+//
+/*///////////////////////////////////////////////////////////////////////*/
+func ClearCurrentDeviceEventList(ip_address string) error {
+	fmt.Println("Received ClearCurrentDeviceEventList\n")
+	currentdeviceinfo := new(importer.Device)
+	currentdeviceinfo.IpAddress = ip_address
+	_, err := cc.ClearCurrentEventList(ctx, currentdeviceinfo)
+
+	return err
 }
 
 func init() {
-        Formatter := new(log.TextFormatter)
-        Formatter.TimestampFormat = "02-01-2006 15:04:05"
-        Formatter.FullTimestamp = true
-        log.SetFormatter(Formatter)
+	Formatter := new(log.TextFormatter)
+	Formatter.TimestampFormat = "02-01-2006 15:04:05"
+	Formatter.FullTimestamp = true
+	log.SetFormatter(Formatter)
 }
 
 func topicListener(topic *string, master sarama.Consumer) {
@@ -180,7 +187,7 @@
 				log.Info("Got message on topic=[%s]: %s", *topic, string(msg.Value))
 			case <-signals:
 				log.Warn("Interrupt is detected")
-		                os.Exit(1)
+				os.Exit(1)
 			}
 		}
 	}()
@@ -188,7 +195,7 @@
 }
 
 func kafkainit() {
-	cmd := exec.Command("/bin/sh","kafka_ip.sh")
+	cmd := exec.Command("/bin/sh", "kafka_ip.sh")
 	var kafkaIP string
 	var out bytes.Buffer
 	cmd.Stdout = &out
@@ -200,8 +207,8 @@
 
 	kafkaIP = out.String()
 	kafkaIP = strings.TrimSuffix(kafkaIP, "\n")
-	kafkaIP = kafkaIP +":9092"
-	fmt.Println("IP address of kafka-cord-0:",kafkaIP)
+	kafkaIP = kafkaIP + ":9092"
+	fmt.Println("IP address of kafka-cord-0:", kafkaIP)
 	config := sarama.NewConfig()
 	config.Consumer.Return.Errors = true
 	master, err := sarama.NewConsumer([]string{kafkaIP}, config)
@@ -219,21 +226,21 @@
 	kafkainit()
 
 	ln, err := net.Listen("tcp", ":9999")
-        if err != nil {
-                fmt.Println("could not listen")
-                log.Fatal("did not listen: %v", err)
-        }
+	if err != nil {
+		fmt.Println("could not listen")
+		log.Fatal("did not listen: %v", err)
+	}
 	defer ln.Close()
 
 	connS, err := ln.Accept()
 	if err != nil {
-                fmt.Println("Accept error")
-                log.Fatal("Accept error: %v", err)
-	}else{
+		fmt.Println("Accept error")
+		log.Fatal("Accept error: %v", err)
+	} else {
 
 		conn, err = grpc.Dial(default_address, grpc.WithInsecure())
 		if err != nil {
-		        fmt.Println("could not connect")
+			fmt.Println("could not connect")
 			log.Fatal("did not connect: %v", err)
 		}
 		defer conn.Close()
@@ -241,7 +248,6 @@
 		cc = importer.NewDeviceManagementClient(conn)
 		ctx = context.Background()
 
-		devicemap = make(map[string] *Device)
 		loop := true
 
 		for loop == true {
@@ -254,153 +260,193 @@
 
 			switch string(cmd) {
 
-			case "attach" :
+			case "attach":
 				cmd_size := len(s)
-				var err	error
-				var aport   string = default_port
-				var avendor string = default_vendor
-				var uafreq  uint64 = default_freq
+				var err error
+				var uafreq uint64
+				if cmd_size == 5 {
+					aip := s[1]
+					aport := s[2]
+					avendor := s[3]
+					afreq := s[4]
+					uafreq, err = strconv.ParseUint(afreq, 10, 64)
 
-				if (cmd_size == 2 || cmd_size == 5){
-					aip    := s[1]
-					if(cmd_size == 5){
-						aport	= s[2]
-						avendor	= s[3]
-						afreq	:= s[4]
-						uafreq, err = strconv.ParseUint(afreq, 10, 64)
-
-						if err != nil {
-							fmt.Print("ParseUint error!!")
-						}
-
-						attach_device_ip = aip + ":" + aport
-					}else{
-						attach_device_ip = aip + ":" + default_port
+					if err != nil {
+						fmt.Print("ParseUint error!!\n")
 					}
 
-					if (devicemap[attach_device_ip] == nil){
-						dev := new (Device)
-						err, newmessage = dev.Attach(attach_device_ip, avendor, uint32(uafreq))
-						if err != nil {
-							fmt.Print("attach error!!")
-						}else{
-							fmt.Print("attatch IP:", attach_device_ip)
-							newmessage = attach_device_ip
-							devicemap[attach_device_ip] = dev
-						}
-					}else{
-						fmt.Print("Change attach IP to %v", attach_device_ip)
+					attach_device_ip = aip + ":" + aport
+
+					err = Attach(attach_device_ip, avendor, uint32(uafreq))
+					if err != nil {
+						errStatus, _ := status.FromError(err)
+						fmt.Println(errStatus.Message())
+						fmt.Println(errStatus.Code())
+						fmt.Print("attach error!!\n")
+						newmessage = errStatus.Message()
+
+					} else {
+						fmt.Print("attatch IP:\n", attach_device_ip)
 						newmessage = attach_device_ip
 					}
-				}else{
-					fmt.Print("Need IP address !!")
+				} else {
+					fmt.Print("Need IP addres,port,vendor,freqs !!\n")
 					newmessage = "Need IP address !!"
 
 				}
-			break
 
-			case "period" :
+			case "period":
 				cmd_size := len(s)
-				if (cmd_size == 2 ){
-					if (devicemap[attach_device_ip] != nil){
-						pv  := s[1]
-						fmt.Print("pv:", pv)
-						u, err := strconv.ParseUint(pv, 10, 64)
+				fmt.Print("cmd_size period %d", cmd_size)
+				if cmd_size == 4 {
+					fip := s[1]
+					fport := s[2]
+					pv := s[3]
+					fmt.Print("pv:", pv)
+					u, err := strconv.ParseUint(pv, 10, 64)
+
+					if err != nil {
+						fmt.Print("ParseUint error!!\n")
+					} else {
+						wd := uint32(u)
+						ip_address := fip + ":" + fport
+						err = UpdateFreq(ip_address, wd)
 
 						if err != nil {
-							fmt.Print("ParseUint error!!")
-						}else{
-							wd := uint32(u)
-							dev := devicemap[attach_device_ip]
-							err, newmessage =  dev.UpdateFreq(wd)
-
-							if err != nil {
-								fmt.Print("period error!!")
-							}else{
-								newmessage = strings.ToUpper(cmd)
-							}
+							errStatus, _ := status.FromError(err)
+							fmt.Println(errStatus.Message())
+							fmt.Println(errStatus.Code())
+							newmessage = errStatus.Message()
+							fmt.Print("period error!!\n")
+						} else {
+							newmessage = strings.ToUpper(cmd)
 						}
-					}else{
-						fmt.Print("need attach first!!")
-						newmessage = "need attach first!!"
 					}
-				}else{
-					fmt.Print("Need period value !!")
+				} else {
+					fmt.Print("Need period value !!\n")
 					newmessage = "Need period value !!"
 				}
 
-			break
-
-			case "sub","unsub" :
+			case "sub", "unsub":
 				cmd_size := len(s)
-				fmt.Print("cmd is :", cmd)
-				if(cmd_size > 4 || cmd_size <0){
+				fmt.Print("cmd is :", cmd, cmd_size)
+				if cmd_size > 6 || cmd_size < 0 {
 					fmt.Print("error event !!")
 					newmessage = "error event !!"
-				}else{
+				} else {
+					ip := s[1]
+					port := s[2]
+					ip_address := ip + ":" + port
 					var events_list []string
-					for i := 1; i < cmd_size; i++ {
+					for i := 3; i < cmd_size; i++ {
 						if value, ok := EVENTS_MAP[s[i]]; ok {
-							events_list = append(events_list,value)
+							events_list = append(events_list, value)
 						} else {
 							fmt.Println("key not found")
 						}
 					}
 
-					if (devicemap[attach_device_ip] != nil){
-						dev := devicemap[attach_device_ip]
-						if(string(cmd) == "sub"){
-							err, newmessage =  dev.Subscribe(events_list)
-							if err != nil {
-								fmt.Print("sub error!!")
-								newmessage = "sub error!!"
-							}else{
-								newmessage = strings.ToUpper(cmd)
-							}
-						}else{
-							err, newmessage =  dev.UnSubscribe(events_list)
-							if err != nil {
-								fmt.Print("unsub error!!")
-								newmessage = "unsub error!!"
-							}else{
-								newmessage = strings.ToUpper(cmd)
-							}
+					if string(cmd) == "sub" {
+						err = Subscribe(ip_address, events_list)
+						if err != nil {
+							errStatus, _ := status.FromError(err)
+							fmt.Println(errStatus.Message())
+							fmt.Println(errStatus.Code())
+							newmessage = errStatus.Message()
+							fmt.Print("sub error!!")
+						} else {
+							newmessage = strings.ToUpper(cmd)
 						}
-					}else{
-						fmt.Print("need attach first !!")
-						newmessage = "need attach first !!"
+					} else {
+						err = UnSubscribe(ip_address, events_list)
+						if err != nil {
+							errStatus, _ := status.FromError(err)
+							fmt.Println(errStatus.Message())
+							fmt.Println(errStatus.Code())
+							newmessage = errStatus.Message()
+							fmt.Print("unsub error!!")
+						} else {
+							newmessage = strings.ToUpper(cmd)
+						}
 					}
 				}
-			break
 
-			case "showeventlist" :
-				if (devicemap[attach_device_ip] != nil){
-					dev := devicemap[attach_device_ip]
-					err, supportlist :=  dev.GetEventSupportList()
+			case "showeventlist":
+				cmd_size := len(s)
+				fmt.Print("cmd is :", cmd, cmd_size)
+				if cmd_size > 3 || cmd_size < 0 {
+					fmt.Print("error event !!")
+					newmessage = "error event !!"
+				} else {
+					vendor := s[1]
+					err, supportlist := GetEventSupportList(vendor)
 
 					if err != nil {
+						errStatus, _ := status.FromError(err)
+						fmt.Println(errStatus.Message())
+						fmt.Println(errStatus.Code())
+						newmessage = errStatus.Message()
 						fmt.Print("showeventlist error!!")
-					}else{
+					} else {
 						fmt.Print("showeventlist ", supportlist)
-						newmessage = strings.Join(supportlist[:],",")
+						newmessage = strings.Join(supportlist[:], ",")
 					}
-				}else{
-					fmt.Print("need attach first !!")
-					newmessage = "need attach first !!"
 				}
 
-			break
+			case "showdeviceeventlist":
+				cmd_size := len(s)
+				fmt.Print("cmd is :", cmd, cmd_size)
+				if cmd_size > 4 || cmd_size < 0 {
+					fmt.Print("error event !!")
+					newmessage = "error event !!"
+				} else {
+					eip := s[1]
+					eport := s[2]
+					ip_address := eip + ":" + eport
+					err, currentlist := GetEventCurrentDeviceList(ip_address)
 
-			case "QUIT" :
+					if err != nil {
+						errStatus, _ := status.FromError(err)
+						fmt.Println(errStatus.Message())
+						fmt.Println(errStatus.Code())
+						newmessage = errStatus.Message()
+						fmt.Print("showdeviceeventlist error!!")
+					} else {
+						fmt.Print("showeventlist ", currentlist)
+						newmessage = strings.Join(currentlist[:], ",")
+					}
+				}
+
+			case "cleardeviceeventlist":
+				cmd_size := len(s)
+				fmt.Print("cmd is :", cmd, cmd_size)
+				if cmd_size > 4 || cmd_size < 0 {
+					fmt.Print("error event !!")
+					newmessage = "error event !!"
+				} else {
+					clip := s[1]
+					clport := s[2]
+					ip_address := clip + ":" + clport
+					err = ClearCurrentDeviceEventList(ip_address)
+					if err != nil {
+						errStatus, _ := status.FromError(err)
+						fmt.Println(errStatus.Message())
+						fmt.Println(errStatus.Code())
+						newmessage = errStatus.Message()
+						fmt.Print("cleardeviceeventlist  error!!")
+					} else {
+						newmessage = strings.ToUpper(cmd)
+					}
+				}
+
+			case "QUIT":
 				loop = false
-	                        newmessage="QUIT"
-			break
+				newmessage = "QUIT"
 
-			default :
-			break
+			default:
 			}
 			// send string back to client
 			connS.Write([]byte(newmessage + "\n"))
-	        }
+		}
 	}
 }
diff --git a/event_subscriber.go b/event_subscriber.go
index 9fe0308..973a765 100644
--- a/event_subscriber.go
+++ b/event_subscriber.go
@@ -15,12 +15,12 @@
 package main
 
 import (
+	"bytes"
 	"encoding/json"
 	"fmt"
 	"net/http"
-	"bytes"
-	"regexp"
 	"os"
+	"regexp"
 )
 
 const RF_SUBSCRIPTION = "/EventService/Subscriptions/"
@@ -29,7 +29,7 @@
 	rtn = false
 
 	destip := os.Getenv("EVENT_NOTIFICATION_DESTIP") + ":" + os.Getenv("DEVICE_MANAGEMENT_DESTPORT")
-	subscrpt_info := map[string]interface{}{"Context":"TBD","Protocol":"Redfish"}
+	subscrpt_info := map[string]interface{}{"Context": "TBD-" + destip, "Protocol": "Redfish"}
 	subscrpt_info["Name"] = event + " event subscription"
 	subscrpt_info["Destination"] = "https://" + destip
 	subscrpt_info["EventTypes"] = []string{event}
@@ -48,7 +48,7 @@
 		json.NewDecoder(resp.Body).Decode(&result)
 		fmt.Println(result)
 		fmt.Println(result["data"])
-		fmt.Println("Add ", event, " subscription failed. HTTP response status: ",  resp.Status)
+		fmt.Println("Add ", event, " subscription failed. HTTP response status: ", resp.Status)
 		return
 	}
 	rtn = true
@@ -119,4 +119,3 @@
 	fmt.Println("Subscription id", id, "was successfully removed")
 	return true
 }
-
diff --git a/main.go b/main.go
index c0d7346..bc0e3ba 100644
--- a/main.go
+++ b/main.go
@@ -15,22 +15,24 @@
 package main
 
 import (
+	importer "./proto"
+	"crypto/tls"
+	"encoding/json"
 	"fmt"
+	"github.com/Shopify/sarama"
+	log "github.com/Sirupsen/logrus"
+	empty "github.com/golang/protobuf/ptypes/empty"
+	"golang.org/x/net/context"
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/codes"
+	"google.golang.org/grpc/status"
+	"io/ioutil"
 	"net"
 	"net/http"
 	"os"
 	"os/signal"
-	"io/ioutil"
-	"github.com/Shopify/sarama"
-	"google.golang.org/grpc"
-	"golang.org/x/net/context"
-	"crypto/tls"
-	empty "github.com/golang/protobuf/ptypes/empty"
-        importer "./proto"
-        log "github.com/Sirupsen/logrus"
-	"time"
-	"encoding/json"
 	"path"
+	"time"
 )
 
 //globals
@@ -43,83 +45,156 @@
 
 var DataProducer sarama.AsyncProducer
 
-var    vendor_default_events = map[string][]string{
-        "edgecore": {"ResourceAdded","ResourceRemoved","Alert"},
-    }
-var redfish_services = [...]string{"/Chassis", "/Systems","/EthernetSwitches"}
+var vendor_default_events = map[string][]string{
+	"edgecore": {"ResourceAdded", "ResourceRemoved", "Alert"},
+}
+var redfish_services = [...]string{"/Chassis", "/Systems", "/EthernetSwitches"}
 var pvmount = os.Getenv("DEVICE_MANAGEMENT_PVMOUNT")
 var subscriptionListPath string
 
-type scheduler struct  {
-	getdata time.Ticker
-	quit chan bool
+type scheduler struct {
+	getdata *time.Ticker
+	quit    chan bool
 }
 
-type device struct  {
-	Subscriptions	map[string]string	`json:"ss"`
-	Freq		uint32			`json:"freq"`
-	Datacollector	scheduler		`json:"-"`
-	Freqchan	chan uint32		`json:"-"`
-	Vendor		string			`json:"vendor"`
-	Protocol	string			`json:"protocol"`
+type device struct {
+	Subscriptions map[string]string `json:"ss"`
+	Freq          uint32            `json:"freq"`
+	Datacollector scheduler         `json:"-"`
+	Freqchan      chan uint32       `json:"-"`
+	Vendor        string            `json:"vendor"`
+	Protocol      string            `json:"protocol"`
 }
 
 type Server struct {
-	devicemap	map[string]*device
-	gRPCserver	*grpc.Server
-	dataproducer	sarama.AsyncProducer
-	httpclient	*http.Client
-	devicechan	chan *importer.DeviceInfo
+	devicemap    map[string]*device
+	gRPCserver   *grpc.Server
+	dataproducer sarama.AsyncProducer
+	httpclient   *http.Client
+	devicechan   chan *importer.DeviceInfo
 }
 
-func (s *Server) GetEventList(c context.Context, info *importer.DeviceInfo) (*importer.SupportedEventList, error) {
+func (s *Server) ClearCurrentEventList(c context.Context, info *importer.Device) (*empty.Empty, error) {
+	fmt.Println("Received GetCurrentEventList\n")
+	ip_address := info.IpAddress
+	_, found := s.devicemap[ip_address]
+	if !found {
+		return nil, status.Errorf(codes.NotFound, "Device not registered")
+	}
+	f := get_subscription_list(ip_address)
+	for event, _ := range s.devicemap[ip_address].Subscriptions {
+		rtn := s.remove_subscription(ip_address, event, f)
+		if !rtn {
+			log.WithFields(log.Fields{
+				"Event": event,
+			}).Info("Error removing event")
+		}
+	}
+	if f != nil {
+		f.Close()
+	}
+	return &empty.Empty{}, nil
+}
+
+func (s *Server) GetCurrentEventList(c context.Context, info *importer.Device) (*importer.EventList, error) {
+	fmt.Println("Received ClearCurrentEventList\n")
+	_, found := s.devicemap[info.IpAddress]
+	if !found {
+		return nil, status.Errorf(codes.NotFound, "Device not registered")
+	}
+	currentevents := new(importer.EventList)
+	for event, _ := range s.devicemap[info.IpAddress].Subscriptions {
+		currentevents.Events = append(currentevents.Events, event)
+	}
+	return currentevents, nil
+}
+
+func (s *Server) GetEventList(c context.Context, info *importer.VendorInfo) (*importer.EventList, error) {
 	fmt.Println("Received GetEventList\n")
-	eventstobesubscribed:= new(importer.SupportedEventList)
+	_, found := vendor_default_events[info.Vendor]
+	if !found {
+		return nil, status.Errorf(codes.NotFound, "Invalid Vendor Provided")
+	}
+	eventstobesubscribed := new(importer.EventList)
 	eventstobesubscribed.Events = vendor_default_events[info.Vendor]
 	return eventstobesubscribed, nil
 }
 
-func (s *Server) SetFrequency(c context.Context,  info *importer.DeviceInfo) (*empty.Empty, error) {
+func (s *Server) SetFrequency(c context.Context, info *importer.FreqInfo) (*empty.Empty, error) {
 	fmt.Println("Received SetFrequency")
+	_, found := s.devicemap[info.IpAddress]
+	if !found {
+		return nil, status.Errorf(codes.NotFound, "Device not registered")
+	}
+
 	s.devicemap[info.IpAddress].Freqchan <- info.Frequency
 	return &empty.Empty{}, nil
 }
 
-func (s *Server) SubsrcribeGivenEvents(c context.Context,  subeventlist *importer.EventList) (*empty.Empty, error) {
+func (s *Server) SubsrcribeGivenEvents(c context.Context, subeventlist *importer.GivenEventList) (*empty.Empty, error) {
 	fmt.Println("Received SubsrcribeEvents\n")
 	//Call API to subscribe events
 	ip_address := subeventlist.EventIpAddress
+	_, found := s.devicemap[ip_address]
+	if !found {
+		return nil, status.Errorf(codes.NotFound, "Device not registered")
+	}
+	if len(subeventlist.Events) <= 0 {
+		return nil, status.Errorf(codes.InvalidArgument, "Event list is empty")
+	}
 	f := get_subscription_list(ip_address)
 	for _, event := range subeventlist.Events {
 		if _, ok := s.devicemap[ip_address].Subscriptions[event]; !ok {
-			s.add_subscription(ip_address, event, f)
+			rtn := s.add_subscription(ip_address, event, f)
+			if !rtn {
+				log.WithFields(log.Fields{
+					"Event": event,
+				}).Info("Error adding  event")
+			}
 		} else {
 			log.WithFields(log.Fields{
 				"Event": event,
-				}).Info("Already Subscribed")
+			}).Info("Already Subscribed")
 		}
 	}
-	if f != nil { f.Close() }
+	if f != nil {
+		f.Close()
+	}
 	return &empty.Empty{}, nil
 }
 
-func (s *Server) UnSubsrcribeGivenEvents(c context.Context,  unsubeventlist *importer.EventList) (*empty.Empty, error) {
+func (s *Server) UnSubsrcribeGivenEvents(c context.Context, unsubeventlist *importer.GivenEventList) (*empty.Empty, error) {
 	fmt.Println("Received UnSubsrcribeEvents\n")
 	ip_address := unsubeventlist.EventIpAddress
+	_, found := s.devicemap[ip_address]
+	if !found {
+		return nil, status.Errorf(codes.NotFound, "Device not registered")
+	}
+
+	if len(unsubeventlist.Events) <= 0 {
+		return nil, status.Errorf(codes.InvalidArgument, "Event list is empty")
+	}
 	//Call API to unsubscribe events
 	f := get_subscription_list(ip_address)
 	for _, event := range unsubeventlist.Events {
 		if _, ok := s.devicemap[ip_address].Subscriptions[event]; ok {
-			s.remove_subscription(ip_address, event, f)
-                } else {
-                                log.WithFields(log.Fields{
-                                  "Event": event,
-                                }).Info("was not Subscribed")
-                        }
-        }
-	if f != nil { f.Close() }
+			rtn := s.remove_subscription(ip_address, event, f)
+			if !rtn {
+				log.WithFields(log.Fields{
+					"Event": event,
+				}).Info("Error removing event")
+			}
+		} else {
+			log.WithFields(log.Fields{
+				"Event": event,
+			}).Info("was not Subscribed")
+		}
+	}
+	if f != nil {
+		f.Close()
+	}
 
-       return &empty.Empty{}, nil
+	return &empty.Empty{}, nil
 }
 
 func (s *Server) collect_data(ip_address string) {
@@ -130,8 +205,10 @@
 		select {
 		case freq := <-freqchan:
 			ticker.Stop()
-			ticker = *time.NewTicker(time.Duration(freq) * time.Second)
-		case  err := <-s.dataproducer.Errors():
+			if freq > 0 {
+				ticker = time.NewTicker(time.Duration(freq) * time.Second)
+			}
+		case err := <-s.dataproducer.Errors():
 			fmt.Println("Failed to produce message:", err)
 		case <-ticker.C:
 			for _, service := range redfish_services {
@@ -143,9 +220,9 @@
 						b := []byte(str)
 						msg := &sarama.ProducerMessage{Topic: importerTopic, Value: sarama.StringEncoder(b)}
 						select {
-						// TODO: this is blocking, maybe a timer?
-						case  s.dataproducer.Input() <- msg:
+						case s.dataproducer.Input() <- msg:
 							fmt.Println("Produce message")
+						default:
 						}
 					}
 				}
@@ -158,22 +235,32 @@
 	}
 }
 
-func (s *Server) SendDeviceInfo(c context.Context,  info *importer.DeviceInfo) (*empty.Empty, error) {
-	d := device {
+func (s *Server) SendDeviceInfo(c context.Context, info *importer.DeviceInfo) (*empty.Empty, error) {
+	d := device{
 		Subscriptions: make(map[string]string),
-		Freq: info.Frequency,
+		Freq:          info.Frequency,
 		Datacollector: scheduler{
-			getdata: *time.NewTicker(time.Duration(info.Frequency) * time.Second),
-			quit: make(chan bool),
+			getdata: time.NewTicker(time.Duration(info.Frequency) * time.Second),
+			quit:    make(chan bool),
 		},
 		Freqchan: make(chan uint32),
-		Vendor: info.Vendor,
+		Vendor:   info.Vendor,
 		Protocol: info.Protocol,
 	}
-        //default_events := [...]string{}
+	_, found := s.devicemap[info.IpAddress]
+	if found {
+		return nil, status.Errorf(codes.AlreadyExists, "Device Already registered")
+	}
+
+	_, vendorfound := vendor_default_events[info.Vendor]
+	if !vendorfound {
+		return nil, status.Errorf(codes.NotFound, "Vendor Not Found")
+	}
+
+	//default_events := [...]string{}
 	s.devicemap[info.IpAddress] = &d
 	fmt.Printf("size of devicemap %d\n", len(s.devicemap))
-	ip_address:= info.IpAddress
+	ip_address := info.IpAddress
 	fmt.Printf("Configuring  %s\n", ip_address)
 	// call subscription function with info.IpAddress
 
@@ -183,18 +270,20 @@
 	for _, event := range default_events {
 		s.add_subscription(ip_address, event, f)
 	}
-	if f != nil { f.Close() }
+	if f != nil {
+		f.Close()
+	}
 	go s.collect_data(ip_address)
 	return &empty.Empty{}, nil
 }
 
 func NewGrpcServer(grpcport string) (l net.Listener, g *grpc.Server, e error) {
-        fmt.Printf("Listening %s\n", grpcport)
-        g = grpc.NewServer()
-        l, e = net.Listen("tcp", grpcport)
-        return
+	fmt.Printf("Listening %s\n", grpcport)
+	g = grpc.NewServer()
+	l, e = net.Listen("tcp", grpcport)
+	return
 }
-func (s *Server) startgrpcserver()error {
+func (s *Server) startgrpcserver() error {
 	fmt.Println("starting gRPC Server")
 	grpcport := ":50051"
 	listener, gserver, err := NewGrpcServer(grpcport)
@@ -211,8 +300,8 @@
 	return nil
 
 }
-func (s *Server) kafkaCloseProducer(){
-	if err :=s.dataproducer.Close(); err != nil {
+func (s *Server) kafkaCloseProducer() {
+	if err := s.dataproducer.Close(); err != nil {
 		panic(err)
 	}
 
@@ -220,7 +309,7 @@
 func (s *Server) kafkaInit() {
 	fmt.Println("Starting kafka init to Connect to broker: ")
 	config := sarama.NewConfig()
-        config.Producer.RequiredAcks = sarama.WaitForAll
+	config.Producer.RequiredAcks = sarama.WaitForAll
 	config.Producer.Retry.Max = 10
 	producer, err := sarama.NewAsyncProducer([]string{"cord-kafka.default.svc.cluster.local:9092"}, config)
 	if err != nil {
@@ -233,19 +322,19 @@
 	signals := make(chan os.Signal, 1)
 	signal.Notify(signals, os.Interrupt)
 
-        fmt.Println(" IN Handle Event  ")
-	if(r.Method ==  "POST"){
+	fmt.Println(" IN Handle Event  ")
+	if r.Method == "POST" {
 		Body, err := ioutil.ReadAll(r.Body)
 		if err != nil {
-			fmt.Println("Error getting HTTP data",err)
+			fmt.Println("Error getting HTTP data", err)
 		}
-		defer  r.Body.Close()
+		defer r.Body.Close()
 		fmt.Println("Received Event Message ")
-		fmt.Printf("%s\n",Body)
-		message :=&sarama.ProducerMessage{
-                        Topic: importerTopic,
-                        Value: sarama.StringEncoder(Body),
-                }
+		fmt.Printf("%s\n", Body)
+		message := &sarama.ProducerMessage{
+			Topic: importerTopic,
+			Value: sarama.StringEncoder(Body),
+		}
 		s.dataproducer.Input() <- message
 	}
 }
@@ -274,7 +363,7 @@
 					d := device{}
 					json.Unmarshal(b, &d)
 					s.devicemap[ip] = &d
-					s.devicemap[ip].Datacollector.getdata = *time.NewTicker(time.Duration(s.devicemap[ip].Freq) * time.Second)
+					s.devicemap[ip].Datacollector.getdata = time.NewTicker(time.Duration(s.devicemap[ip].Freq) * time.Second)
 					s.devicemap[ip].Datacollector.quit = make(chan bool)
 					s.devicemap[ip].Freqchan = make(chan uint32)
 					go s.collect_data(ip)
@@ -285,14 +374,14 @@
 }
 
 func init() {
-        Formatter := new(log.TextFormatter)
-        Formatter.TimestampFormat = "02-01-2006 15:04:05"
-        Formatter.FullTimestamp = true
-        log.SetFormatter(Formatter)
+	Formatter := new(log.TextFormatter)
+	Formatter.TimestampFormat = "02-01-2006 15:04:05"
+	Formatter.FullTimestamp = true
+	log.SetFormatter(Formatter)
 	fmt.Println("Connecting to broker: ")
 	fmt.Println("Listening to  http server")
-        log.Info("log Connecting to broker:")
-        log.Info("log Listening to  http server ")
+	log.Info("log Connecting to broker:")
+	log.Info("log Listening to  http server ")
 	//sarama.Logger = log.New()
 }
 
@@ -300,7 +389,7 @@
 	if pvmount == "" {
 		return nil
 	}
-	f, err := os.OpenFile(subscriptionListPath + "/" + ip, os.O_CREATE|os.O_RDWR, 0664)
+	f, err := os.OpenFile(subscriptionListPath+"/"+ip, os.O_CREATE|os.O_RDWR, 0664)
 	if err != nil {
 		fmt.Println(err)
 	}
@@ -313,16 +402,15 @@
 	http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
 	client := &http.Client{
 		Timeout: 10 * time.Second,
-		}
+	}
 
-	s := Server {
-		devicemap:	make(map[string]*device),
-		devicechan:	make(chan *importer.DeviceInfo),
-		httpclient:	client,
+	s := Server{
+		devicemap:  make(map[string]*device),
+		devicechan: make(chan *importer.DeviceInfo),
+		httpclient: client,
 	}
 
 	s.kafkaInit()
-//TODO: check if we should keep this as goroutines?
 	go s.runServer()
 	go s.startgrpcserver()
 
diff --git a/proto/importer.proto b/proto/importer.proto
index 1ec491b..dd85cd1 100644
--- a/proto/importer.proto
+++ b/proto/importer.proto
@@ -14,25 +14,45 @@
 	string protocol = 4;
 }
 
-message EventList {
+message GivenEventList {
 	string event_ip_address = 1;
         repeated string events = 2;
 }
 
-message SupportedEventList {
+message EventList {
         repeated string events = 1;
 }
 
+message FreqInfo {
+	string IpAddress = 1;
+	uint32 Frequency = 2;
+}
+
+message VendorInfo {
+	string Vendor = 1;
+}
+
+message Device {
+	string IpAddress = 1;
+}
+
+
+message Empty {}
 service device_management {
     rpc SendDeviceInfo(DeviceInfo) returns (google.protobuf.Empty) {}
 
-    rpc SetFrequency(DeviceInfo) returns (google.protobuf.Empty) {}
+    rpc SetFrequency(FreqInfo) returns (google.protobuf.Empty) {}
 
-    rpc GetEventList(DeviceInfo) returns (SupportedEventList) {}
+    rpc GetEventList(VendorInfo) returns (EventList) {}
 
-    rpc SubsrcribeGivenEvents(EventList)  returns (google.protobuf.Empty) {}
+    rpc SubsrcribeGivenEvents(GivenEventList)  returns (google.protobuf.Empty) {}
 
-    rpc UnSubsrcribeGivenEvents(EventList) returns (google.protobuf.Empty) {}
+    rpc UnSubsrcribeGivenEvents(GivenEventList) returns (google.protobuf.Empty) {}
+
+    rpc GetCurrentEventList(Device) returns (EventList) {}
+
+    rpc ClearCurrentEventList(Device) returns (google.protobuf.Empty) {}
+
 }
 
 
