Merge of last version of Salim's code