Added new register method and added check on deregister