added more support for on_entry, on_exit