some changes to the code