Updated initialization function.