Bug fixes and performance enhancements