some changes made to code