Didi some changes to the code