Start redesign main algorithm