Made some changes to previous code