initial coding for third problem, testing