Performance enhancements and bug fixes