Added a stub code to improve events handling in the monitor() function