solutions to problems 6 & 7 jjang!