working on algo script