Not finished yet, but getting better !
Shitty algorithm