Made some changes to the code