corrected wrt changes in the code