Solution to assigment 2.