Bug fixes and better event integration