Finished Ex 2 and 4

Completed exercises 2 and 4.