Updated attack function