My solution to assignement 2.