added first algorithm