rewrote class & handler registration. added more event code