My attempt at assignment 2.