Changing the count variable to num