Improved the initialization code