developed new algorithm for p5js