finished first part of 7th lab, added helper function for part 2