Homework assignment done for Andree Wallin's class (Week 6). Struggled a lot with this one, but managed to push through.