Fixed init code to be general.