Dev- update code from Aidan and made it compatible with Roei