Improved performance and added initialization.