Improved performance and minor changes