v2. adding attack function