added doc for beforeSend and afterSend