adding solutions to problems 3 - 6