Well, this is the third part of exercise 2.  To be honest, it could be better.