update algoritm and write file service