Finished implementation of exercise 2