changed bruteforce method. removed unnececarry for loop.