integrated Saad's changes