[+] better algorithm