Improved matrix search by changing indexes, errors in detetion of attacks