Giorgio changes
Used Sriram's changes