Brute force that logically works, but too slow