offline/online event handlers. not finished.