Solution to final assigment.