Improved performance and bug fixes