Added onRegister hook