Unregister events that are no longer needed.
Use callback handlers instead of custom spaghetti code.
Minor style change