Updated the brute force code