add Bon code for handling events, also better logging