updated design, work on algo