improved initialization routine