added unregister function