Various fixes and improvements, new events and commands.