More code related to event management. Implementation of major commands.