Further redundant code removal in the isAttacked function