All the parts of exercise 2 in one file