Develop

Improve algorithm