Made master brute-search function