Restructured initialization code