Cleaned up the initialization code