algorythm initilization