afterAdd function added