First attempt at assignment 2

Appears to work fine against test cases found on the Forum.