Brute force implementation