Final version, works but too long to compute

Next step is trying optimized brutforce to reduce overhead