Working on question 2, getting segmentation fault