Implemented a few event callbacks.